mirror of
https://github.com/typicode/json-server.git
synced 2025-07-28 04:32:24 +08:00
working database save
This commit is contained in:
@ -47,7 +47,7 @@ function createApp(db, options) {
|
||||
// Enable CORS for everything
|
||||
app.use(cors());
|
||||
app.options('*', cors());
|
||||
|
||||
|
||||
// Set app.router
|
||||
app.use(app.router);
|
||||
|
||||
@ -63,6 +63,7 @@ function createApp(db, options) {
|
||||
|
||||
// Set database
|
||||
routes.setDatabase(db);
|
||||
app.db = routes.db;
|
||||
|
||||
// And done! Ready to serve JSON!
|
||||
return app;
|
||||
@ -88,7 +89,8 @@ function run(db, options) {
|
||||
logger.success('Express server listening on port ' + options.port);
|
||||
logger.success('Congrats! Open http://localhost:' + options.port);
|
||||
});
|
||||
return app;
|
||||
}
|
||||
|
||||
exports.createApp = createApp;
|
||||
exports.run = run;
|
||||
exports.run = run;
|
||||
|
Reference in New Issue
Block a user