Created
June 27, 2017 17:44
-
-
Save jonDowdle/5fa7a9148c3ca594b4e5e252d88b7748 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:6.11-alpine | |
WORKDIR /deploy | |
ADD package.json /deploy | |
RUN npm install | |
ADD index.js /deploy | |
CMD node index.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Example - Create service on server with NeDB database | |
/// [dependencies] | |
const feathers = require('feathers'); | |
const NeDB = require('nedb'); | |
const path = require('path'); | |
const service = require('feathers-nedb'); | |
//! [dependencies] | |
/// [feathers] | |
const app = feathers() | |
.configure(services); | |
//! [feathers] | |
/// [create] | |
const users = app.service('/users'); | |
Promise.all([ | |
users.create({ email: 'jane.doe@gmail.com', password: '11111', role: 'admin' }), | |
users.create({ email: 'john.doe@gmail.com', password: '22222', role: 'user' }), | |
users.create({ email: 'judy.doe@gmail.com', password: '33333', role: 'user' }) | |
]) | |
//! [create] | |
/// [results] | |
.then(results => { | |
console.log('created Jane Doe item\n', results[0]); | |
console.log('created John Doe item\n', results[1]); | |
console.log('created Judy Doe item\n', results[2]); | |
return users.find() | |
.then(results => console.log('find all items\n', results)); | |
}) | |
.catch(err => console.log('Error occurred:', err)); | |
//! [results] | |
/// [services] | |
function services() { | |
this.use('/users', service({ Model: userModel() })); | |
} | |
function userModel() { | |
return new NeDB({ | |
filename: path.join('examples', 'step', 'data', 'users.db'), | |
autoload: true | |
}); | |
} | |
//! [services] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "BasicGuide", | |
"description": "Step by Step Guide To Basic Feathers", | |
"version": "0.0.0", | |
"homepage": "https://github.com/feathersjs/feathers-docs", | |
"license": "MIT", | |
"repository": { | |
"type": "git", | |
"url": "git://github.com/feathersjs/feathers-docs.git" | |
}, | |
"author": { | |
"name": "Feathers contributors", | |
"email": "hello@feathersjs.com", | |
"url": "https://feathersjs.com" | |
}, | |
"contributors": [], | |
"bugs": { | |
"url": "https://github.com/feathersjs/feathers-docs/issues" | |
}, | |
"engines": { | |
"node": ">= 6.0.0" | |
}, | |
"scripts": { | |
"build": "./examples/make-diffs.sh && gitbook build" | |
}, | |
"dependencies": { | |
"ajv": "4.11.5", | |
"body-parser": "1.17.1", | |
"compression": "1.6.2", | |
"cors": "2.8.3", | |
"feathers": "2.1.1", | |
"feathers-authentication": "0.7.12", | |
"feathers-authentication-local": "0.3.2", | |
"feathers-configuration": "0.4.1", | |
"feathers-errors": "2.6.2", | |
"feathers-hooks": "1.8.1", | |
"feathers-hooks-common": "^3.5.0", | |
"feathers-nedb": "2.6.2", | |
"feathers-rest": "1.7.1", | |
"feathers-sequelize": "^2.0.0", | |
"feathers-socketio": "1.5.2", | |
"helmet": "3.5.0", | |
"nedb": "1.8.0", | |
"pg": "^6.2.3", | |
"sequelize": "^3.30.4", | |
"serve-favicon": "2.4.2", | |
"socket.io-client": "1.7.3", | |
"winston": "2.3.1" | |
}, | |
"devDependencies": { | |
"eslint": "3.19.0", | |
"mocha": "3.2.0", | |
"request": "2.81.0", | |
"request-promise": "4.2.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment