An Angular 2 quick start combined with Express and ready to be hooked up to a MongoDB database. Clone this and set up your MongoDB separately (e.g. with Mlab), then create a .env file specifying your database details.
Clone from Github for a local version
Clone from Gomix for a live, hosted version
Uses Mongoose to hook up to MongoDB. Includes an example Schema and corresponding Angular component and model.
I can't take credit for the Express and Mongoose code. These parts were mostly copied from the wonderful tutorials by:
Ganga Chris and
The Angular 2 was generated with Angular CLI version 1.0.0-rc.0.
Run node server.js
in root directory after build. Navigate to http://localhost:3000/ to view the app.
Run ng generate component component-name
to generate a new component. You can also use ng generate directive/pipe/service/class/module
.
Run ng build
to build the project. The build artifacts will be stored in the dist/
directory. Use the -prod
flag for a production build.
Create a .env
file in the root directory describing your MongoDB database. It should be in the format:
`
USER=joe PASS=thisisapassword HOST=localhost DB_PORT=5000 DB=mydb
`
Run ng test
to execute the unit tests via Karma.
Run ng e2e
to execute the end-to-end tests via Protractor.
Before running the tests make sure you are serving the app via ng serve
.
To get more help on the Angular CLI use ng help
or go check out the Angular CLI README.