REST in Pieces: Fully Capable REST Service for Testing Client-Side Components
What does the BEAN stand for?
BEAN (Bootstrap, Express, AngularJS, Node.js)
http://localhost:8080/names - Returns a random set of names with the following data:
Setting the Offset (default 0) and Limit (default 10)
Capping out the maximum number of records the service can provide, useful for providing end-of-data scenarios.
Turning off the Metadata object to get only pure data
Changing the name of the output results array
Front-End Package Management and Automation
We have adopted two powerful tools for package management and automation (there are several key ones out there):
The gruntfile.js and bower.json files used by Grunt and Bower are pre-configured for out-of-the-box development.
No databases are used for this REST service, and instead all data is stored in memory.
Developer Install Script:
sudo npm install -g grunt-cli; sudo npm install -g bower; sudo npm install -g forever; npm install;
When performing a clean install, npm looks at the package.json folder.
Make sure there is no "node_modules" folder. The "install" command creates that folder and downloads all necessary dependencies and devDependencies listed in package.json. It is best to do everything from scratch for all new projects.
Starting the application:
Please make sure the "forever" node package has been installed globally.
Traditionally, an ExpressJS application can be started with the "node app.js" command. We use "npm start" to run the application. npm looks inside the package.json file for instructions on what configuration options to use for the 'start' command in the "scripts" section.
If you see the "uncaughtException: listen EADDRINUSE" then you need to configure different ports in config/config.js.
- Development: running on port 8080
- Staging: running on port 8080
- Production: running on port 80
See the CHANGELOG.