diff --git a/stubs/api/index.js b/stubs/api/index.js index 4a9e3a7..6a7dc94 100644 --- a/stubs/api/index.js +++ b/stubs/api/index.js @@ -2,4 +2,63 @@ /* eslint-disable @typescript-eslint/no-require-imports */ const router = require('express').Router(); +const commonError = { success: false, message: 'Что то пошло не так' }; + +const stubs = { masters: 'success', orders: 'success' }; + +router.get('/arm/masters', (req, res) => { + res + .status(/error/.test(stubs.masters) ? 500 : 200) + .send( + /^error$/.test(stubs.masters) + ? commonError + : require(`../json/arm-masters/${stubs.masters}.json`), + ); +}); + +router.get('/arm/orders', (req, res) => { + res + .status(/error/.test(stubs.orders) ? 500 : 200) + .send( + /^error$/.test(stubs.orders) + ? commonError + : require(`../json/arm-orders/${stubs.orders}.json`), + ); +}); + +router.get('/admin', (req, res) => { + res.send(`