- [Instructor] Let's begin by creating…a new message post and point in Node.…So let's open up our server.js.…Then, let's copy our app.get on line 11 through line 13.…And we'll paste it below.…Next, let's change the get to a post.…Then, since we're not responding with a message list,…instead of using res.send on line 16,…we use res.sendStatus…and we'll pass in 200 for 200 OK.…
This will let the client know that everything went well.…Finally as the test, above our res.sendStatus…we'll use a console.log to display the req.body…to see what data we get in our body.…In order to try this, we can't easily send…a post request with the browser,…so we'll use an app called Postman.…You can get Postman from the Chrome app store…or as a standalone app for Windows or Mac.…Once Postman starts, let's update the URL…with our post endpoint of localhost:3000/messages.…
Then in the dropdown on the left,…instead of using the GET action,…we'll specify a POST action.…Then finally, we can go to the body tab and select raw…and then in the dropdown, instead of Text,…
Author
Updated
4/5/2019Released
11/7/2017- Asynchronous tasks and callbacks
- Benefits and features of JavaScript
- Managing third-party packages with npm
- Node.js frameworks
- Static serving with Express
- Creating a browser app
- Exploring databases
- Saving data to MongoDB with Mongoose
- Error handling and debugging
- Simple tests and async tests
Skill Level Beginner
Duration
Views
-
Introduction
-
Welcome41s
-
-
1. Introduction to Node
-
Download and install Node1m 28s
-
2. Understanding npm: Node Package Manager
-
Write your own module2m 18s
-
-
3. Reading and Writing Files
-
Read from files4m 31s
-
Access directories1m 6s
-
Write to a file2m 46s
-
-
4. Exploring Web Frameworks
-
Node.js frameworks1m 23s
-
Express1m 6s
-
Socket.io55s
-
-
5. Building Your Demo App Chat Client for the Browser
-
Static serving with Express5m 30s
-
Create your browser app8m 43s
-
Create your Socket.io event1m 59s
-
-
6. Exploring Databases
-
Types of data frameworks2m 2s
-
Set up MongoDB1m 46s
-
Mongoose2m 59s
-
-
7. Improving Asynchronous Code
-
Nested callbacks3m 27s
-
Promises7m 14s
-
Async/await2m 44s
-
-
8. Error Handling and Debugging
-
Try/catch2m 6s
-
Finally1m 40s
-
Editor debugging4m 14s
-
-
9. Testing
-
Simple test with Jasmine4m 33s
-
Async test with Jasmine5m 33s
-
-
Conclusion
-
Next steps1m 24s
-
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.
CancelTake notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.
Share this video
Embed this video
Video: Create a post messages service