Introduction
JSON Server is an npm package that allows you to create REST JSON web service, backed by a simple database. It is created for front end developers and helps to perform all CRUD operations without a proper backend prototype or structure. A valid json file will suffice.
Steps to follow.
Now we’ll start by creating a new project for mock web service.
Step 1
Create an Angular project setup using the below command or however you want to create it.
ng new projectname
Example,
ng new angularJson

Step 2 - Installing JSON Server
Since JSON Server is available as an NPM package, we can perform the installation by using the Node.js package manager.
Run the below command in the terminal.
npm install Json-server

Step 3 - Create a sample json file with data
JSON Server will take a JSON file from your main project folder and turn it into a RESTful database with all the right routes. It can even do things like search queries.
- "posts": [{
- "id": 1,
- "title": "AngularJS (1.0.0)",
- "releaseDate": "June 14th, 2012"
- }, {
- "id": 2,
- "title": "Angular 2",
- "releaseDate": "September 14, 2016"
- }, {
- "id": 3,
- "title": "Angular 4",
- "releaseDate": "March 23, 2017"
- }, {
- "id": 4,
- "title": "Angular 5",
- "releaseDate": "November 1, 2017"
- }, {
- "id": 5,
- "title": "Angular 6",
- "releaseDate": "May 4th, 2018"
- }, {
- "id": 6,
- "title": "Angular 7",
- "releaseDate": "October 18, 2018"
- }, {
- "id": 6,
- "title": "Angular 8",
- "releaseDate": "May 28, 2019"
- }]
- }






JosephsPosted Oct 22, 2020, 11:30 AM
When i run server data not coming