Seed project that integrates the Angular CLI with NodeJS/Express.
This project was put together using yarn
rather than npm
.
Run npm install -g yarn
to install yarn
Run yarn
or yarn install
to install the dependencies
Two sections below outline how to run this project for development and production.
It will take some time for the Angular application to build, so if it doesn't show up in the browser, wait for a while and then refresh it.
For these, you will also need to make sure you have nodemon
installed:
npm install -g nodemon
Note
At the time I tested this, there was a bug that was preventing file deletion. To get around this, I have included a Linux/MacOS command to delete the dist
folder prior to running the build. If you are using a Windows terminal, you will need to replace rm -rf dist
with rmdir dist /s /q
in package.json
.
I will get around to installing a third-party utility to make this compatible across operating systems; but don't hold your breath waiting ;)
Run yarn serve-dev
for a dev server. Navigate to http://localhost:3000/
. The app will automatically reload if you change any of the source files.
You may have to refresh the browser to see any changes.
Run yarn serve-prod
.
This will build the Angular application using ng build --prod
enabling minification and Ahead-Of-Time (AOT) compilation. It will then serve up on localhost:3000
You may have to refresh the browser to see any changes.
The api is accessed using the path localhost:3000/api
. I've include a stub just to show that it works.
Run ng generate component component-name
to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|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.
Run ng test
to execute the unit tests via Karma.
Run ng e2e
to execute the end-to-end tests via Protractor.
To get more help on the Angular CLI use ng help
or go check out the Angular CLI README.