Advanced Node.js Development
上QQ阅读APP看书,第一时间看更新

Resource Creation Endpoint - POST /todos

In this section, you're going to create your HTTP POST route for adding new Todos. Before we dive into that, we're first going to refactor everything we have in server.js. We have database configuration stuff which should live somewhere else and we have our models, which should also live in separate files. The only thing we want in server.js is our Express route handlers.