Make sure you have installed all of the following prerequisites on your development machine:
- Git - Download & Install Git. OSX and Linux machines typically have this already installed.
- Node.js - Download & Install Node.js and the npm package manager. If you encounter any problems, you can also use this GitHub Gist to install Node.js.
- MongoDB - Download & Install MongoDB, and make sure it's running on the default port (27017).
- Bower - You're going to use the Bower Package Manager to manage your front-end packages. Make sure you've installed Node.js and npm first, then install bower globally using npm:
$ npm install -g bower
Once you've downloaded the boilerplate and installed all the prerequisites, you're just a few steps away from starting to develop your MEAN application.
The boilerplate comes pre-bundled with a package.json
and bower.json
files that contain the list of modules you need to start your application.
To install the dependencies, run this in the application folder from the command-line:
$ npm install
This command does a few things:
- First it will install the dependencies needed for the application to run.
- If you're running in a development environment, it will then also install development dependencies needed for testing and running your application.
- When the npm packages install process is over, npm will initiate a bower install command to install all the front-end modules needed for the application
- To update these packages later on, just run
npm update
Run application using npm:
$ npm start
Application should run on port 3000 with the development environment configuration, so in the browser just go to http://localhost:3000
To run application with production environment configuration:
$ npm run start:prod
Explore config/env/production.js
for production environment configuration options.
It can run the full test suite included with MEAN.JS with the test task:
$ npm test
This will run both the server-side tests (located in the app/tests/
directory) and the client-side tests (located in the public/modules/*/tests/
).
To execute only the server tests, run the test:server task:
$ npm run test:server
To execute only the server tests and run again only changed tests, run the test:server:watch task:
$ npm run test:server:watch
And to run only the client tests, run the test:client task:
$ npm run test:client
$ docker-compose up
- Local development and testing with just Docker:
$ docker build -t mean .
$ docker run -p 27017:27017 -d --name db mongo
$ docker run -p 3000:3000 --link db:db_1 mean
$
- To enable live reload, forward port 35729 and mount /app and /public as volumes:
$ docker run -p 3000:3000 -p 35729:35729 -v /Users/mdl/workspace/mean-stack/mean/public:/home/mean/public -v /Users/mdl/workspace/mean-stack/mean/app:/home/mean/app --link db:db_1 mean
- Production deployment with compose:
$ docker-compose -f docker-compose-production.yml up -d
- Production deployment with just Docker:
$ docker build -t mean -f Dockerfile-production .
$ docker run -p 27017:27017 -d --name db mongo
$ docker run -p 3000:3000 --link db:db_1 mean