Test node movie REST API - mickeyr007/node-movie GitHub Wiki
Install Postman - REST Client on Chrome
After running the following command on the terminal for node app
node server.js
You should get the following line in return
Movie REST API is running on port 8080/api
Following are the supported REST API instructions
Route | HTTP Verb | Description | Data |
/api/movies | GET |
Get all the movies. | |
/api/movies/:actor_name | GET |
Get all the movies with actor name. | |
/api/movies | POST |
Create a movie. |
|
/api/movies/:movie_id | GET |
Get a single movie. | |
/api/movies/:movie_id | PUT |
Update a movie with new info. |
title = Title of the movie
|
/api/movies/:movie_id | DELETE |
Delete a movie. |
Notice that we are sending the name data as x-www-form-urlencoded. This will send all of our data to the Node server as query strings.
curl -X POST -H "Cache-Control: no-cache" -H "Postman-Token: 3db4cb2b-1f73-2d4f-1a99-5035fc17b1f2" -H "Content-Type: application/x-www-form-urlencoded" -d 'title=Test+Movie&description=Description+for+the+movie&producer=Producer+Name&actors=actor1%2Cactor2' http://localhost:8080/api/movies