The second part of this guide is going to focus on building out our REST API, and adding MongoDB to the mix. Relevant links from the previous tutorial are listed below.
In order to return a list of todos, we’ll first need to create a Schema
definition for our todo. We’ll set this up in the
Mongoose provides a clean API for working with MongoDB that makes setting up our models fairly painless.
We can now add the various routes for listing, creating, updating, and deleting
todos. We’re going to list our routes in
server/routes.js. This file will be
responsible for requiring our controllers, and mapping specific paths to
We’ll also need to require our
server/routes.js file in
server.js. This is
Our next step will be creating the controller that’s going to handle our route
actions. We’ll do this by creating the
specified in our
Our back-end is now prepared to handle the Getting Started Ember.JS tutorial. We will need to make some small changes to the tutorial for it to function correctly with Ember Data.
The changes we’ll be making are to
todos_controller.js, on line 9, you need to change
todos.js, on lines 15 and 26, you’ll also need to update