fix
This commit is contained in:
@@ -1,13 +1,17 @@
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import jsonServer from 'json-server';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
|
||||
const server = jsonServer.create();
|
||||
const router = jsonServer.router(path.join(import.meta.dir, 'db.json'));
|
||||
const router = jsonServer.router(path.join(__dirname, 'db.json'));
|
||||
|
||||
// Serve static files từ folder public (images, etc.)
|
||||
const middlewares = jsonServer.defaults({
|
||||
logger: true,
|
||||
static: path.join(import.meta.dir, 'public'),
|
||||
static: path.join(__dirname, 'public'),
|
||||
});
|
||||
|
||||
const port = process.env.PORT || 3100;
|
||||
|
||||
Reference in New Issue
Block a user