json-server
json-server copied to clipboard
Get a full fake REST API with zero coding in less than 30 seconds (seriously)
I am trying to follow one older tutorial: https://www.journeytoawebapp.com/posts/local-mock-server-with-node Fresh repository I copy-pasted the code: ``` const jsonServer = require('json-server'); const server = jsonServer.create(); const middlewares = jsonServer.defaults(); const accounts...
How can I configure CORS?
DB file: ```json { "days": [ { "id": 1, "date": "2024-03-04T00:00:00", "hours": 6, "timeRanges": [ { "id": 1, "dayId": 1, "start": "2024-03-04T08:00:00", "end": "2024-03-04T12:00:00", "image": null }, { "id": 2,...
I want to set it up as a post request, but it always gives me a 404 error. Server js file: const jsonServer = require("json-server"); const cors = require("cors"); const...
``` { "id": 3, "savedActivity": true, "title": "Data is Interconnected", "author": { "firstName": "Victoria", "lastName": "Matthews"} } ``` becomes ``` { "id": "3", "savedActivity": true, "title": "Data is Interconnected", "author":...
I tried to reproduce the following locally: https://github.com/typicode/json-server/issues/167 I copied the route to my routes.json: ``` "/Data/Items/:itemId/Document/:id.json": "/Document/:id" ``` I then added Document to my db.js file in my js...
Is there a way to configure so it will always return the default index file? Regardless if there is a ./public directory? I am having an issue when using this...
i try many times this "http://localhost:3000/Products?q=mobile" but this not working so anyone pls help and my db.json file this "Products": [ { "productName": "Boat ", "price": "2999", "color": "black", "category":...
I can't see this issue documented anywhere else and have tried different versions of json-server Running on Apple M1 Pro Node: 20.9.0 json-server: 1.0.0-alpha.23 Have tried running from npx, json-server...