Skip to content

Commit

Permalink
Merge branch 'release/1.4.2' into production
Browse files Browse the repository at this point in the history
  • Loading branch information
Raymond Feng committed Jan 7, 2014
2 parents 05dd7bc + 73a0014 commit 754fda9
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 8 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

[See the full documentation](http://docs.strongloop.com/display/DOC/LoopBack).

## API

[Browse the API documentation](http://apidocs.strongloop.com/loopback).

## Mailing List

Discuss features and ask questions on [LoopBack Forum](https://groups.google.com/forum/#!forum/loopbackjs).
Expand Down
14 changes: 7 additions & 7 deletions docs/api.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## Node.js API

* [App](api-app.md)
* [Model](api-model.md)
* [Remote methods and hooks](api-model-remote.md)
* [DataSource](api-datasource.md)
* [GeoPoint](api-geopoint.md)
* [REST API](rest.md)
* [App](#app-object)
* [DataSource](#data-source-object)
* [GeoPoint](#geopoint-object)
* [Model](#model-object)
* [Remote methods and hooks](#remote-methods-and-hooks)
* [REST API](#rest-api)
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/

var loopback = module.exports = require('./lib/loopback');
var datasourceJuggler = require('loopback-datasource-juggler');

/**
* Connectors
Expand All @@ -17,3 +18,4 @@ loopback.Mail = require('./lib/connectors/mail');
*/

loopback.GeoPoint = require('loopback-datasource-juggler/lib/geo').GeoPoint;
loopback.ValidationError = datasourceJuggler.ValidationError;
10 changes: 10 additions & 0 deletions lib/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,11 @@ app.boot = function(options) {
app.get('port') ||
3000;

appConfig.restApiRoot =
appConfig.restApiRoot ||
app.get('restApiRoot') ||
'/api';

if(appConfig.host !== undefined) {
assert(typeof appConfig.host === 'string', 'app.host must be a string');
app.set('host', appConfig.host);
Expand All @@ -252,6 +257,11 @@ app.boot = function(options) {
app.set('port', appConfig.port);
}

assert(appConfig.restApiRoot !== undefined, 'app.restBasePath is required');
assert(typeof appConfig.restApiRoot === 'string', 'app.restBasePath must be a string');
assert(/^\//.test(appConfig.restApiRoot), 'app.restBasePath must start with "/"');
app.set('restApiRoot', appConfig.restBasePath);

for(var configKey in appConfig) {
var cur = app.get(configKey);
if(cur === undefined || cur === null) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"Platform",
"mBaaS"
],
"version": "1.4.1",
"version": "1.4.2",
"scripts": {
"test": "mocha -R spec"
},
Expand Down
5 changes: 5 additions & 0 deletions test/app.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ describe('app', function() {
app: {
port: 3000,
host: '127.0.0.1',
restApiRoot: '/rest-api',
foo: {bar: 'bat'},
baz: true
},
Expand Down Expand Up @@ -71,6 +72,10 @@ describe('app', function() {
assert.equal(this.app.get('host'), '127.0.0.1');
});

it('should have restApiRoot setting', function() {
assert.equal(this.app.get('restApiRoot'), '/rest-api');
});

it('should have other settings', function () {
expect(this.app.get('foo')).to.eql({
bar: 'bat'
Expand Down
7 changes: 7 additions & 0 deletions test/loopback.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
describe('loopback', function() {
describe('exports', function() {
it('ValidationError', function() {
expect(loopback.ValidationError).to.be.a('function')
.and.have.property('name', 'ValidationError');
});
});

describe('loopback.createDataSource(options)', function(){
it('Create a data source with a connector.', function() {
var dataSource = loopback.createDataSource({
Expand Down

0 comments on commit 754fda9

Please sign in to comment.