This exercise is based on the i-Car LoopBack app from Miroslav Bajtos.
You must have already installed Node.js.
$ npm install -g strongloop
If you run into any issues, see Installing StrongLoop for more information.
EC Exercise 2.1
This application was created using LoopBack tools. See Building from scratch below for more details.
Run the application
Start the application back-end by running the following command:
$ node .
Now open your browser and point it to http://127.0.0.1:3000/explorer to access the application UI.
/calendarexposes a queryable (filter, sort) collection of available calendar items over HTTP / JSON
Configuring the data source
By default, the sample application uses the memory connector and listens on the port 3000 on all network interfaces.
You can configure other data sources by adding a new key to
var DATASTORES =custom:connector: 'my-custom-connector'// configuration for the custom connectormemory:// etc.;
The sample can be configured using the following environment variables:
DB: The db type, use
IP: The http server listener ip address or hostname, default to
PORT: The http server listener port number, default to
To run the application at port 3001 with MongoDB:
$ DB=mongodb PORT=3001 node .
To run the application at port 3002 with Oracle:
$ DB=oracle PORT=3002 node .
The project is composed from multiple components.
models/contains definition of models and implementation of custom model methods.
rest/contains the REST API server, it exposes the shared models via REST API.
server/is the main HTTP server that brings together all other components.
test/provides few basic unit-tests to verify that the server provides the expected API.
Refer to Creating an application for more information.
One last thing. Just run npm install to install the required dependencies.