Skip to content

eagerworks/angular2-express-starter

Repository files navigation

Angular 2 with Express starter project template. Heroku ready.

Simple Angular 2 starter project template, uses node.js with express as a server. Project base was generated using angular-cli. angular-cli is used for the development environment and Express for production. Heroku ready. You can try the live version here.

Installation

Make sure you have node (and npm) installed on your system.

  1. Clone this repository:
git clone https://github.com/eagerworks/angular2-express-starter.git
  1. Navigate to the project:
cd angular2-express-starter
  1. Install angular-cli, typescript and typings (typescript defintion manager):
npm install angular-cli --global
npm install typescript --global
npm install typings --global
  1. Fill package.json with appropiate information about your project (name, version, description, etc.)

  2. Install packages:

npm install
  1. Run ng serve to start the server on a development environment

  2. Navigate to localhost:4200

  3. You are all set!

Testing

To run unit tests:

ng test

Unit tests are located under the src/app/specs folder.

To run end-to-end tests:

ng e2e

End-to-end tests are located under the e2e folder.

Deploying to heroku

This project uses an Express server for production environment, that lets you fine tune how the app is served. If you want to test it locally, run:

npm postinstall
npm start

Take into account that the server forces an https redirection by default.

Notes

An example service is included under src/app/services/user_service.ts that shows how to perform basic user authentication. Some minimal styles are shown for both global and component styling under src/styles.scss and src/app/stylesheets respectively.

Express server is located under the /server folder. You can tune it to your specific needs. The server does an https redirection to force a secure connection, if you want to disable this behaviour just comment the app.use(forceSSL()); line.

Environment variables can be defined on src/enviroments. Update the files contained there accordingly, to point to your API endpoints.

Contributing

Bug reports and pull requests are welcome

  1. Fork it ( https://github.com/eagerworks/angular2-express-starter/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

This project was brought to you by eagerWorks