diff --git a/changelog.md b/changelog.md index 6f78879bac..da561fa9ae 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,13 @@ # Change Log +## [v3.0.0](https://github.com/feathersjs/feathers/tree/v3.0.0) (2017-11-01) +[Full Changelog](https://github.com/feathersjs/feathers/compare/v3.0.0-pre.3...v3.0.0) + +**Merged pull requests:** + +- Update dependencies to enable Greenkeeper 🌴 [\#708](https://github.com/feathersjs/feathers/pull/708) ([greenkeeper[bot]](https://github.com/apps/greenkeeper)) +- Feathers v3 core \(Buzzard\) [\#697](https://github.com/feathersjs/feathers/pull/697) ([daffl](https://github.com/daffl)) + ## [v3.0.0-pre.3](https://github.com/feathersjs/feathers/tree/v3.0.0-pre.3) (2017-10-25) [Full Changelog](https://github.com/feathersjs/feathers/compare/v3.0.0-pre.2...v3.0.0-pre.3) diff --git a/lib/application.js b/lib/application.js index e9053c376c..b35a0897cd 100644 --- a/lib/application.js +++ b/lib/application.js @@ -78,6 +78,10 @@ const application = { }, use (path, service, options = {}) { + if (typeof path !== 'string' || stripSlashes(path) === '') { + throw new Error(`'${path}' is not a valid service path.`); + } + const location = stripSlashes(path); const isSubApp = typeof service.service === 'function' && service.services; const isService = this.methods.concat('setup').some(name => diff --git a/lib/index.js b/lib/index.js index 4b4719a16f..17897f8ee7 100644 --- a/lib/index.js +++ b/lib/index.js @@ -16,3 +16,6 @@ function createApplication () { createApplication.version = version; module.exports = createApplication; + +// For better ES module (TypeScript) compatibility +module.exports.default = createApplication; diff --git a/lib/version.js b/lib/version.js index 07b0385836..0bc0991071 100644 --- a/lib/version.js +++ b/lib/version.js @@ -1 +1 @@ -module.exports = '3.0.0'; +module.exports = '3.0.1'; diff --git a/package-lock.json b/package-lock.json index 257269dbaf..1b9c514216 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@feathersjs/feathers", - "version": "3.0.0", + "version": "3.0.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index bf253943cf..4f35fc7afb 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@feathersjs/feathers", "description": "A REST and realtime API layer for modern applications.", - "version": "3.0.0", + "version": "3.0.1", "homepage": "http://feathersjs.com", "repository": { "type": "git", @@ -13,7 +13,7 @@ "socket.io", "realtime" ], - "main": "lib/index", + "main": "lib/index.js", "author": { "name": "Feathers contributor", "email": "hello@feathersjs.com", @@ -59,7 +59,7 @@ "istanbul": "^1.1.0-alpha.1", "jshint": "^2.9.4", "mocha": "^4.0.0", - "nsp": "^2.6.2", + "nsp": "^3.0.0", "semistandard": "^11.0.0" } } diff --git a/readme.md b/readme.md index c4a6785ff1..b7ecbbba50 100644 --- a/readme.md +++ b/readme.md @@ -34,7 +34,7 @@ Here is all the code you need to create a RESTful, real-time message API that us ```js // app.js const feathers = require('@feathersjs/feathers'); -const expressify = require('@feathersjs/express') +const express = require('@feathersjs/express') const socketio = require('@feathersjs/socketio'); const handler = require('@feathersjs/errors/handler'); @@ -42,14 +42,14 @@ const memory = require('feathers-memory'); // Create a Feathers application that is also fully compatible // with an Express app -const app = expressify(feathers()); +const app = express(feathers()); // Parse HTTP JSON bodies -app.use(expressify.json()); +app.use(express.json()); // Parse URL-encoded params -app.use(expressify.urlencoded({ extended: true })); +app.use(express.urlencoded({ extended: true })); // Add REST API support -app.configure(expressify.rest()); +app.configure(express.rest()); // Configure Socket.io real-time APIs app.configure(socketio()); // Register our memory "messages" service @@ -72,7 +72,7 @@ npm install @feathersjs/feathers @feathersjs/express @feathersjs/socketio @feath node app ``` -and go to [http://localhost:3000/messages](http://localhost:3000/messages). That's it! There's a lot more you can do with Feathers including; using a real database, authentication, authorization, clustering and more! Head on over to [the Feathers docs](http://docs.feathersjs.com) to see just how easy it is to build scalable real-time apps. +and go to [http://localhost:3030/messages](http://localhost:3030/messages). That's it! There's a lot more you can do with Feathers including; using a real database, authentication, authorization, clustering and more! Head on over to [the Feathers docs](http://docs.feathersjs.com) to see just how easy it is to build scalable real-time apps. ## Documentation diff --git a/test/application.test.js b/test/application.test.js index 15c8c8891e..5a9cf66dc5 100644 --- a/test/application.test.js +++ b/test/application.test.js @@ -3,6 +3,10 @@ const Proto = require('uberproto'); const feathers = require('../lib'); describe('Feathers application', () => { + it('adds an ES module `default` export', () => { + assert.equal(feathers, feathers.default); + }); + it('initializes', () => { const app = feathers(); @@ -73,6 +77,28 @@ describe('Feathers application', () => { }); describe('Services', () => { + it('calling .use with invalid path throws', () => { + const app = feathers(); + + try { + app.use('/', {}); + } catch (e) { + assert.equal(e.message, `'/' is not a valid service path.`); + } + + try { + app.use('', {}); + } catch (e) { + assert.equal(e.message, `'' is not a valid service path.`); + } + + try { + app.use({}, {}); + } catch (e) { + assert.equal(e.message, `'[object Object]' is not a valid service path.`); + } + }); + it('calling .use with a non service object throws', () => { const app = feathers();