You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Finally, you will create routes to add new users and new schedules.
For this, you will have to create the following routes in POST :
‘/schedules’ to add a new schedule. It will return the newly created schedule.
‘/users’ (this time in POST!) to add a new user. It will return the newly created user. The user's password must be encrypted in SHA256.
To test these routes, you will need to make POST requests and send data as if there was a form.
This is done using the -X POST option (to specify that the request is in POST), combined with the -d option to specify the data attached to the request.
Finally, you will create routes to add new users and new schedules.
For this, you will have to create the following routes in POST :
‘/schedules’ to add a new schedule. It will return the newly created schedule.
‘/users’ (this time in POST!) to add a new user. It will return the newly created user. The user's password must be encrypted in SHA256.
To test these routes, you will need to make POST requests and send data as if there was a form.
This is done using the -X POST option (to specify that the request is in POST), combined with the -d option to specify the data attached to the request.
Here is an example of a command line session:
$> curl localhost:3000/users
[{"firstname":"James","lastname":"Bond","email":"james.bond@gmail.com","password":"b6b7fb4cad4bc020f76e16889a8e9065cb708d0f8c304a8a3db609b644da9536"},{"firstname":"Tony","lastname":"Stark","email":"starkrulz@gmail.com","password":"a836ebba36776b21dd0f5cdca497bff65c5bdfc8411cfbfe0111f27bde1c1894"},{"firstname":"Ali","lastname":"G","email":"nameisnotborat@gmail.com","password":"3b5fe14857124335bb8832cc602f8edcfa12db42be36b135bef5bca47e3f2b9c”}]
$> curl localhost:3000/users/3
$> curl -d "firstname=Donald&lastname=Duck&email=coincoin@gmail.com&password=daisy" -X POST localhost:3000/users
{"firstname":"Donald","lastname":"Duck","email":"coincoin@gmail.com","password":"QgKe8hUlb4+p/ttTVC7mVT7vdgJ7EW+PrFNGIRseRzw="}Mezards-MacBook-Pro:dmaiga laurie$
$> curl localhost:3000/users
[{"firstname":"James","lastname":"Bond","email":"james.bond@gmail.com","password":"b6b7fb4cad4bc020f76e16889a8e9065cb708d0f8c304a8a3db609b644da9536"},{"firstname":"Tony","lastname":"Stark","email":"starkrulz@gmail.com","password":"a836ebba36776b21dd0f5cdca497bff65c5bdfc8411cfbfe0111f27bde1c1894"},{"firstname":"Ali","lastname":"G","email":"nameisnotborat@gmail.com","password":"3b5fe14857124335bb8832cc602f8edcfa12db42be36b135bef5bca47e3f2b9c"},{"firstname":"Donald","lastname":"Duck","email":"coincoin@gmail.com","password":"QgKe8hUlb4+p/ttTVC7mVT7vdgJ7EW+PrFNGIRseRzw="}]
$> curl localhost:3000/users/3
{"firstname":"Donald","lastname":"Duck","email":"coincoin@gmail.com","password":"QgKe8hUlb4+p/ttTVC7mVT7vdgJ7EW+PrFNGIRseRzw=“}
The text was updated successfully, but these errors were encountered: