DEV Community

Discussion on: Build a Rest API using NodeJS and ExpressJS with MongoDB

Collapse
 
puzzledog profile image
PuzzleDog

While I am only a beginner at web development, it seems to me that there might be a typographical error in the following paragraph:

Routes are the endpoints of your API that clients can access to retrieve or manipulate data. In Express, you can define routes using the app.METHOD() functions, where METHOD is the HTTP method (e.g. GET, POST, PUT, DELETE) that the route will handle. For example, here's how you might define a route that handles *GET * requests to the /posts path:

app.post('/api/add-data', (req, res) => {
    // Code to handle the request and send a response
})
Enter fullscreen mode Exit fullscreen mode

It seems to me that the above code should handle POST requests to the /posts path, not "GET" requests.