Backend API Setup
Steps
In the
demos
directory, installjson-server
cd demos //if you aren't there already
npm install json-server@0.16.2Create an
api
directory at the top level in your project soprojectpilot\api
Click 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...zip
and unzip it.Copy the
db.json
file inside the196d97...
directory into theprojectpilot\api
directoryOpen
package.json
Add the following script:
"scripts": {
"start": "serve -s",
+ "api": "json-server ./api/db.json"
},
Run the server
npm run api
You 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