Merge branch 'release/1.4.2' into production

This commit is contained in:
Raymond Feng 2014-01-07 15:33:17 -08:00
commit 754fda9dec
7 changed files with 36 additions and 8 deletions

View File

@ -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).

View File

@ -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)

View File

@ -3,6 +3,7 @@
*/
var loopback = module.exports = require('./lib/loopback');
var datasourceJuggler = require('loopback-datasource-juggler');
/**
* Connectors
@ -17,3 +18,4 @@ loopback.Mail = require('./lib/connectors/mail');
*/
loopback.GeoPoint = require('loopback-datasource-juggler/lib/geo').GeoPoint;
loopback.ValidationError = datasourceJuggler.ValidationError;

View File

@ -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);
@ -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) {

View File

@ -9,7 +9,7 @@
"Platform",
"mBaaS"
],
"version": "1.4.1",
"version": "1.4.2",
"scripts": {
"test": "mocha -R spec"
},

View File

@ -44,6 +44,7 @@ describe('app', function() {
app: {
port: 3000,
host: '127.0.0.1',
restApiRoot: '/rest-api',
foo: {bar: 'bat'},
baz: true
},
@ -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'

View File

@ -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({