Today we are going to build a blog. Not just any blog, but a MEEN blog. What is a MEEN blog you ask? Well why don’t you just keep on reading, instead of asking questions to no one in particular.
The MongoDB downloads page does not provide any command-line friendly links or instructions to download their product. Luckily there was this: Install MongoDB on Linux which has a command-line friendly approach to download the latest version of MongoDB. Perfect.
The instructions are pretty straightforward. I created a ‘mongodb’ directory in my home folder, and created ‘/data/db’ that mongod will be using to store its data, with the correct file permissions.
Before we get started with building our API with Express, we are going to need to install node.
I prefer installing node locally via one of these methods. Doing this will avoid a mess of permission problems you may encounter when using globally installed node modules, especially when modules require global installation. Global installs go into a directory in your home folder (which should be included in your path) and you will not have to use sudo –ever–. This saves keystrokes and is also a safer way to operate in Linux.
(You can ignore the curl request to npmjs.org; npm is now included with node.)
I am going to use the Express Application Generator. With it you can run ‘express [dir name]‘ and it will scaffold out an express app. You will need to navigate into the directory and run ‘npm install’.
The first thing we want to do is install mongoose, which basically acts as our ORM for accessing our mongo database from our Express app.
Ember – Creating new records and storing them, etc …
Ember – Attaching multiple routes to a single controller
Ember – Make sure API returns JSON for POST requests as well…