muchow-test-1
TBD
Last updated 3 years ago by foxrider .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install muchow-test-1 
SYNC missed versions from official npm registry.

This exercise is based on the i-Car LoopBack app from Miroslav Bajtos.

Prerequisites

You must have already installed Node.js.

Install StrongLoop:

$ 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.

REST APIs

  • /calendar exposes 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 DATASTORES object in rest/datasources.local.js:

var DATASTORES = {
  custom: {
    connector: 'my-custom-connector',
    // configuration for the custom connector
  },
  memory: {
  },
  // etc.
};

The sample can be configured using the following environment variables:

  • DB: The db type, use memory, mongodb or oracle
  • IP: The http server listener ip address or hostname, default to 0.0.0.0 (any address)
  • PORT: The http server listener port number, default to 3000

For example,

  • 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 .

Project files

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.

Current Tags

  • 0.0.2                                ...           latest (3 years ago)

2 Versions

  • 0.0.2                                ...           3 years ago
  • 0.0.1                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (18)
Dev Dependencies (3)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |