Skip to content

superopengl/angular2-with-express-starter

Repository files navigation

angular2-with-express-starter

For using angularCLI-with-express-starter you have to be installed globally: node.js, npm, nodemon, typescript, angular CLI

First, clone the project:

$ git clone https://github.com/commercialsuicide/angularCLI-with-express-starter.git
$ cd angularCLI-with-express-starter

Install necessary dependencies:

$ npm install

Run the project in developer mode

For running the angularCLI-with-express-starter, you can run express server and angular CLI separately in two different terminals:

$ npm run startExpress

and

$ npm run startAngular

Or start both client end and server end in one terminal:

$ npm start

Now open localhost:4200 and check the connection between Angular and Express: push the "Test" button on the page. If it shows "Requests to server are OK" - the connection is OK.

For communication between Angular and Express we are using proxy, proxy configuration is in proxy.config.json. When you need to create more routes, you have to add them to proxy.config.json too, by analogy with default /test-route.

If watcher doesn't update changes (on linux)

If watcher doesn't update changes, you have to change the amount of watches. The problem with inotify is reseting this counter every time you restart your computer. You can fix it on linux (and should fix it after every computer restart) by executing the following command:

$ echo 65536 | sudo tee -a /proc/sys/fs/inotify/max_user_watches

And then restart npm run startExpress and npm run startAngular commands.

Build the project

You can build the project using

$ ng build

Or for production usage you have to build your app using

$ ng build --prod --aot

About

How to start Angular 2/4 with Express server

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages