mirror of
https://github.com/Nezumi-2711/json-server-vercel.git
synced 2026-09-22 13:38:40 +00:00
Update server.js
This commit is contained in:
+7
-7
@@ -4,15 +4,15 @@ const jsonServer = require('json-server')
|
|||||||
const server = jsonServer.create()
|
const server = jsonServer.create()
|
||||||
|
|
||||||
// Uncomment to allow write operations
|
// Uncomment to allow write operations
|
||||||
// const fs = require('fs')
|
const fs = require('fs')
|
||||||
// const path = require('path')
|
const path = require('path')
|
||||||
// const filePath = path.join('db.json')
|
const filePath = path.join('db.json')
|
||||||
// const data = fs.readFileSync(filePath, "utf-8");
|
const data = fs.readFileSync(filePath, "utf-8");
|
||||||
// const db = JSON.parse(data);
|
const db = JSON.parse(data);
|
||||||
// const router = jsonServer.router(db)
|
const router = jsonServer.router(db)
|
||||||
|
|
||||||
// Comment out to allow write operations
|
// Comment out to allow write operations
|
||||||
const router = jsonServer.router('db.json')
|
// const router = jsonServer.router('db.json')
|
||||||
|
|
||||||
const middlewares = jsonServer.defaults()
|
const middlewares = jsonServer.defaults()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user