Get started with MEAN

To get started, we suggest the following steps:

Step 1: Create a new MEAN project

To create a new MEAN project, create a new folder for your project and then create a new Express project:

$ mkdir projects
$ cd projects
$ express --view pug sample
$ cd sample
$ npm install

To start the application, use this command:

$ DEBUG=sample:* ./bin/www

To access the application and see its output, browse to http://localhost:3000/. To end the application, terminate the running Express process.

For more information, refer to these instructions.

Step 2: Add MongoDB and AngularJS to your MEAN application

You can connect your application with MongoDB using MongooseJS, an object modelling driver for Node.js. It is already installed in the MEAN stack so you only have to add the following lines to your app.js file:

var Mongoose = require('mongoose');
var db = Mongoose.createConnection('mongodb://USER:PASSWORD@localhost/DATABASE');

You can use install AngularJS in your application with Bower. Create a file named .bowerrc in your application with the following content:

{ "directory" : "public/javascripts/vendor" }

Then, run this command in the project directory:

$ bower install angular

For more information, refer to these instructions.

Last modification April 22, 2020