diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..8056443 --- /dev/null +++ b/.babelrc @@ -0,0 +1,4 @@ +{ + "plugins": [ "add-module-exports" ], + "presets": [ "es2015" ] +} diff --git a/.npmignore b/.npmignore index 3b851a1..2f65a84 100644 --- a/.npmignore +++ b/.npmignore @@ -1,4 +1,9 @@ +.editorconfig +.npmignore +.jshintrc +.travis.yml +.babelrc .idea/ src/ test/ -!lib/ \ No newline at end of file +!lib/ diff --git a/README.md b/README.md index 16205e0..565412f 100644 --- a/README.md +++ b/README.md @@ -25,17 +25,15 @@ Please refer to the [Feathers database adapter documentation](http://docs.feathe Here is an example of a Feathers server with a `todos` in-memory service that supports pagination: ```js -// app.js -var feathers = require('feathers'); -var bodyParser = require('body-parser'); -var memory = require('feathers-memory'); +import feathers from 'feathers'; +import bodyParser from 'body-parser'; +import rest from 'feathers-rest'; +import memory from '../lib'; // Create a feathers instance. -var app = feathers() - // Enable Socket.io - .configure(feathers.socketio()) +const app = feathers() // Enable REST services - .configure(feathers.rest()) + .configure(rest()) // Turn on JSON parser for REST services .use(bodyParser.json()) // Turn on URL-encoded parser for REST services @@ -62,11 +60,11 @@ app.service('todos').create({ var port = 3030; app.listen(port, function() { - console.log('Feathers server listening on port ' + port); + console.log(`Feathers server listening on port ${port}`); }); ``` -You can run this example by using `node examples/app` and going to [localhost:3030/todos](http://localhost:3030/todos). You will see the test Todo that we created at the end of that file. +You can run this example by using `npm run example` and going to [localhost:3030/todos](http://localhost:3030/todos). You will see the test Todo that we created at the end of that file. ## Changelog diff --git a/example/app.js b/example/app.js index ef88120..b002952 100644 --- a/example/app.js +++ b/example/app.js @@ -1,13 +1,12 @@ -var feathers = require('feathers'); -var bodyParser = require('body-parser'); -var memory = require('../lib'); +import feathers from 'feathers'; +import bodyParser from 'body-parser'; +import rest from 'feathers-rest'; +import memory from '../lib'; // Create a feathers instance. -var app = feathers() - // Enable Socket.io - .configure(feathers.socketio()) +const app = feathers() // Enable REST services - .configure(feathers.rest()) + .configure(rest()) // Turn on JSON parser for REST services .use(bodyParser.json()) // Turn on URL-encoded parser for REST services @@ -25,4 +24,4 @@ app.use('/todos', memory({ // Start the server module.exports = app.listen(3030); -console.log('Feathers Todo memory service running on 127.0.0.1:3030'); \ No newline at end of file +console.log('Feathers Todo memory service running on 127.0.0.1:3030'); diff --git a/package.json b/package.json index 8813501..32f8b27 100644 --- a/package.json +++ b/package.json @@ -8,12 +8,7 @@ "feathers", "feathers-plugin" ], - "license": [ - { - "type": "MIT", - "url": "https://github.com/feathersjs/feathers-memory/blob/master/LICENSE" - } - ], + "license": "MIT", "repository": { "type": "git", "url": "git://github.com/feathersjs/feathers-memory.git" @@ -40,15 +35,18 @@ "watch": "babel --watch -d lib/ src/", "jshint": "jshint src/. test/. --config", "mocha": "mocha test/ --compilers js:babel-core/register", - "test": "npm run compile && npm run jshint && npm run mocha && nsp check" + "test": "npm run compile && npm run jshint && npm run mocha && nsp check", + "example": "babel-node example/app.js" }, "directories": { "lib": "lib" }, "dependencies": { "babel-polyfill": "^6.2.0", + "feathers": "^2.0.0-pre.4", "feathers-errors": "^1.1.4", "feathers-query-filters": "^1.1.1", + "feathers-rest": "^1.1.1", "lodash": "^3.10.1", "uberproto": "^1.2.0" }, @@ -58,18 +56,9 @@ "babel-plugin-add-module-exports": "^0.1.1", "babel-preset-es2015": "^6.1.2", "body-parser": "^1.14.1", - "feathers": "^1.1.1", "feathers-service-tests": "^0.5.0", "jshint": "^2.8.0", "mocha": "^2.3.3", "nsp": "^2.2.0" - }, - "babel": { - "plugins": [ - "add-module-exports" - ], - "presets": [ - "es2015" - ] } }