const express = require('express');
const app = express();
var appData = require('../data.json');
var seller = appData.seller;
var goods = appData.goods;
var ratings = appData.ratings;
var apiRoutes = express.Router();
app.use('/api',apiRoutes);
devServer:{
before(app) {
app.get('/api/seller', (req, res) => {
res.json({
// 杩欓噷鏄綘鐨刯son鍐呭
errno: 0,
data: seller
})
})
}
......
}
localhost:8080/api/seller锛宺esult 200 status code, not result json data, why?
please help me
Hi, thanks for your interest but Github issues are for bug reports and feature requests only. You can ask questions on the forum, the Discord server, gitter or StackOverflow.
for those looking for an answer, I solved this by placing my .json file in the public folder
so to fetch i.e fetch('/products.json') the file should be in public/products.json
Most helpful comment
for those looking for an answer, I solved this by placing my .json file in the public folder
so to fetch i.e
fetch('/products.json')the file should be inpublic/products.json