Questions tagged [json-server]

json-server allows you to rapidly create a REST API server that delivers JSON data.

json-server is a tool written in that allows you to rapidly create a server that when started up, delivers json data via a API.

You can use json-server for rapid prototyping and mocking out other REST API services.

Supply a JSON file to describes the JSON data and the API that will deliver it and json-server will start up a server that provides that data via a REST API

Source Code and further documentation https://github.com/typicode/json-server

Installation npm install json-server

Egghead Video (free) Nodejs: Creating demo apis with json-server

477 questions
-1
votes
3 answers

Distinct Unique Keys with JSON Server

I am using json-server from typicode, it works but is it possible to get requested key values as an array? For example I have { "users": [ { "name": "ABC", "job": "Engineer", "age" : 28 }, …
Ali J
  • 1
-1
votes
1 answer

Searching in json-server

I am trying to use json-server using npm { "refunded":{ "data":[ { "order_id":"8", "order_no":"o000000008", "orderdate":"2018-01-23 23:20:00", "ordertype":"TakeAway", …
raju
  • 6,448
  • 24
  • 80
  • 163
-1
votes
1 answer

json-server add read-only route with middleware

In my json-server setup I'd like to set a read-only route. So instead of setting that route in the db.json file, I'm using a middleware (named middleware.js): module.exports = (req, res, next) => { if (req.url === '/authenticate') { res.body =…
Francesco Borzi
  • 56,083
  • 47
  • 179
  • 252
-1
votes
1 answer

jQuery Ajax Post changes object structure

Today, I'm working the first time with Ajax and facing a strange problem. While using jQuery to make an Ajax 'POST' request, it creates some strange syntax. I haven't found an answer to this in other questions, actually, I also don't know what I…
Brudus
  • 749
  • 1
  • 8
  • 22
-2
votes
1 answer

JSON server: & and |

Titles for query: ["title1", "title2", "title3 & title3] Request for json server looks this way: ?title1 | title2 | title3&title3 And this works until order is changed: title3&title3|title1|title2 (this query ingore everything after ampersand…
En Kratia
  • 74
  • 1
  • 5
-2
votes
1 answer

I can't disable CORS in json-server

When I try to send data via POST to a json-server I get error 500, with Referrer Policy: strict-origin-when-cross-origin. I tried using the --no-cors option to disable CORS (npx json-server --watch db.json --port 3002 --no-cors), but it didn't work.…
Priscila
  • 45
  • 1
  • 7
-2
votes
3 answers

react cypress json-server restore to original database after test

Hey so I'm test react app with cypress and having a fake api with json-server. When I run some of the test, it will change the datebase my db.json file. So the plan was to restore the database after each test to the original. Here's my…
-2
votes
4 answers

Json-server to real URL

I have a link to my json database (db.json) on Json-server: http://localhost:3000/places Now i want to upload this json database on real hosting. The question is how to access an array 'places' in db.json on real hosting url? Something like this is…
Proger
  • 1
  • 1
-2
votes
1 answer

Json file server does not make a Fetch

I created a Json file, and is running ok, but it doesn't insert a new item, only delete is working. Below follows the code. I'm just simulating a server with some input, delete and update, I'm working with React 18.1.0 and Material-ui. The json data…
-2
votes
1 answer

Deploy React app with JSON-server as backend

I made a simple CRUD application that is supposed to be an appointment manager based on Traversy's Task Manager (found here: https://www.youtube.com/watch?v=w7ejDZ8SWv8), and now I'm trying to publish it. I have found a number of guides but none…
miguelC
  • 21
  • 4
-2
votes
1 answer

I'm traying to list from json server to a table

getting the error trying to declare d in subscribe this is my service public apiUrl = 'http://localhost:3000/'; constructor(public http: HttpClient) {} KayitListele() { return this.http.get(this.apiUrl + 'kayitlar'); } from ts file of the…
Geek0011
  • 1
  • 2
1 2 3
31
32