mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-11-30 00:53:14 +00:00
Add mock server module
This commit is contained in:
17
mock-backend/src/server.js
Normal file
17
mock-backend/src/server.js
Normal 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')
|
||||
});
|
||||
Reference in New Issue
Block a user