From 98309793dcb4a7236889261676ecf2e2ec7642e1 Mon Sep 17 00:00:00 2001 From: Loi Phan <123229563+Nez27@users.noreply.github.com> Date: Sat, 13 Jan 2024 21:05:40 +0700 Subject: [PATCH] Update server.js --- api/server.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/api/server.js b/api/server.js index ff5faa4..98d3fbd 100644 --- a/api/server.js +++ b/api/server.js @@ -4,15 +4,15 @@ const jsonServer = require('json-server') const server = jsonServer.create() // Uncomment to allow write operations -// const fs = require('fs') -// const path = require('path') -// const filePath = path.join('db.json') -// const data = fs.readFileSync(filePath, "utf-8"); -// const db = JSON.parse(data); -// const router = jsonServer.router(db) +const fs = require('fs') +const path = require('path') +const filePath = path.join('db.json') +const data = fs.readFileSync(filePath, "utf-8"); +const db = JSON.parse(data); +const router = jsonServer.router(db) // Comment out to allow write operations -const router = jsonServer.router('db.json') +// const router = jsonServer.router('db.json') const middlewares = jsonServer.defaults()