Add mock server module

This commit is contained in:
Akshay
2023-10-08 19:10:17 +05:30
parent f724f10a35
commit 6f634c3f13
5 changed files with 1559 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
import jsonServer from 'json-server';
import routes from './mocks/routes.json' assert { type: "json" };
const server = jsonServer.create();
const router = jsonServer.router('./src/mocks/db.json');
const middlewares = jsonServer.defaults();
server.use(middlewares);
server.use(jsonServer.rewriter(routes));
server.use(router);
server.listen(7091, () => {
console.log('JSON Server is running')
});