angular-dev-server
a simple express-based local development server for AngularJS projects
Install
Install using npm:
npm install -g angular-dev-server
Usage
When you start the server, it assumes a project structure that looks like this:
- app/
- scripts/
- controllers/
- directives/
- filters/
- services/
- app.js
- views/
- main.html
- index.html
- scripts/
- public/
- css/
- img/
- js/
Start the server:
angular-dev-server
Open your web browser to:
http://localhost:8787/
API Pass-through
Sometimes when you're developing locally you're also going to be running the backend REST API server. Thanks to CORS, any requests to the server might be blocked by your web browser. To prevent CORS blockage, angular-dev-server lets you pass in an API url and acts as a proxy and proxies requests to /api
to the API server.
To use the API pass through run this:
angular-dev-server --api http://localhost:9999/
When you check http://localhost:8787/api/
a request will be passed through angular-dev-server to your REST API server.