angular-rest-browser — column browser for REST APIs
Getting Started
To get you started you can simply clone the angular-rest-browser repository and install the dependencies:
Install Dependencies
We have two kinds of dependencies in this project: tools and angular framework code. The tools help us manage and test the application.
- We get the tools we depend upon via
npm
, the [node package manager][npm]. - We get the angular code via
bower
, a [client-side code package manager][bower].
We have preconfigured npm
to automatically run bower
so we can simply do:
npm install
Behind the scenes this will also call bower install
. You should find that you have two new
folders in your project.
-
node_modules
- contains the npm packages for the tools we need -
bower_components
- contains the angular framework files
Run the Application
We have preconfigured the project with a simple development web server. The simplest way to start this server is:
npm start
Now browse to the app at http://localhost:8000/app/index.html
.
Serving the Application Files
While angular is client-side-only technology and it's possible to create angular webapps that
don't require a backend server at all, we recommend serving the project files using a local
webserver 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 file://
scheme instead of http://
.
Running the App during Development
The angular-rest-browser project comes preconfigured with a local development webserver. It is a node.js
tool called [http-server][http-server]. You can start this webserver 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 server static files, from a folder, by running:
http-server
Alternatively, you can choose to configure your own webserver, such as apache or nginx. Just
configure your server to serve the files under the app/
directory.
Running the App in Production
This really depends on how complex is your app and the overall infrastructure of your system, but
the general rule is that all you need in production are all the files under the app/
directory.
Everything else should be omitted.
Angular apps are really just a bunch of static html, css and js files that just need to be hosted somewhere, where 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 webserver(s).
Continuous Integration
Travis CI
[Travis CI][travis] is a continuous integration service, which can monitor GitHub for new commits
to your repository and execute scripts such as building the app or running tests. The angular-rest-browser
project contains a Travis configuration file, .travis.yml
, which will cause Travis to run your
tests when you push to GitHub.
You will need to enable the integration between Travis and GitHub. See the Travis website for more instruction on how to do this.