Hackit game for my 2 years at Irontec
- Have some fun
- Learn some moder web application technics
- Do a simple hack-it
- Try to not use server side programming (maybe some server header to make it more fun)
While Angular is client-side-only technology and it is possible to create Angular web apps that
do not require a backend server at all, we recommend serving the project files using a local
web server during development to avoid issues with security restrictions (sandbox) in browsers. The
sandbox implementation varies between browsers, but quite often prevents things like cookies, XHR,
etc to function properly when an HTML page is opened via the file://
scheme instead of http://
.
The angular-seed
project comes preconfigured with a local development web server. It is a Node.js
tool called http-server. You can start this web server with npm start
, but you may
choose to install the tool globally:
sudo npm install -g http-server
Then you can start your own development web server to serve static files from a folder by running:
http-server -a localhost -p 8000
Alternatively, you can choose to configure your own web server, such as Apache or Nginx. Just
configure your server to serve the files under the app/
directory.
This really depends on how complex your app is and the overall infrastructure of your system, but
the general rule is that all you need in production are the files under the app/
directory.
Everything else should be omitted.
Angular apps are really just a bunch of static HTML, CSS and JavaScript files that need to be hosted somewhere they can be accessed by browsers.
If your Angular app is talking to the backend server via XHR or other means, you need to figure out what is the best way to host the static files to comply with the same origin policy if applicable. Usually this is done by hosting the files by the backend server or through reverse-proxying the backend server(s) and web server(s).
For more information on AngularJS please check out angularjs.org.