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.
Make sure you have node
(and npm
) installed on your system.
- Clone this repository:
git clone https://github.com/eagerworks/angular2-express-starter.git
- Navigate to the project:
cd angular2-express-starter
- Install angular-cli,
typescript
andtypings
(typescript defintion manager):
npm install angular-cli --global
npm install typescript --global
npm install typings --global
-
Fill
package.json
with appropiate information about your project (name, version, description, etc.) -
Install packages:
npm install
-
Run
ng serve
to start the server on a development environment -
Navigate to
localhost:4200
-
You are all set!
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.
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.
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.
Bug reports and pull requests are welcome
- Fork it ( https://github.com/eagerworks/angular2-express-starter/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
This project was brought to you by eagerWorks