Backend API Setup
Steps
In the
demosdirectory, installjson-servercd demos //if you aren't there already
npm install json-server@0.16.2Create an
apidirectory at the top level in your project soprojectpilot\apiClick this link to open this db.json file on Github
On the Github page, in the upper right hand corner of the page click the Download ZIP button
Open your downloads folder and find
196d97...zipand unzip it.Copy the
db.jsonfile inside the196d97...directory into theprojectpilot\apidirectoryOpen
package.jsonAdd the following script:
"scripts": {
"start": "serve -s",
+ "api": "json-server ./api/db.json"
},
Run the server
npm run apiYou should see the following result:
\{^_^}/ hi!
Loading ./api/db.json
Done
Resources
http://localhost:3000/posts
http://localhost:3000/comments
http://localhost:3000/albums
http://localhost:3000/photos
http://localhost:3000/users
http://localhost:3000/todos
Home
http://localhost:3000