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 in the /home/bitnami directory and then create a new Express project:

$ cd /home/bitnami
$ mkdir projects
$ cd projects
$ express sample
$ cd sample
$ npm install

To start the application, use this command:

$ ./bin/www

By default, the application will run on port 3000.

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

NOTE: Access to the server on port 3000 may be blocked for security reasons. In this case, you must first create an SSH tunnel between your local system and the server before you can access the application using these instructions.

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 July 25, 2019