git ssb

1+

dinoworm ๐Ÿ› / catstack



Commit 33c8c3ea806c7b24197e47850836a31c48daefd6

setup todos service

Michael Williams committed on 1/8/2016, 3:19:03 AM
Parent: d7bb4a1cb809f7db3135cc7d21052d9c2636bd45

Files changed

.gitignorechanged
app/api.jschanged
app/todos/service.jschanged
config/development.jschanged
package.jsonchanged
knexfile.jsadded
migrations/20160108004846_create_todos.jsadded
.gitignoreView
@@ -1,5 +1,4 @@
11 /node_modules
22 npm-debug.log*
33
44 /build
5-/db*
app/api.jsView
@@ -4,27 +4,29 @@
44 import rest from 'feathers-rest'
55 import bodyParser from 'body-parser'
66 import { map, mapObjIndexed, reduce, toPairs } from 'ramda'
77
8-const services = {
9- ...map(
8+import memory from 'feathers-memory'
9+
10+const services = Object.assign(
11+ map(
1012 (module) => module.service.default,
1113 bulk(__dirname, '*/service.js')
1214 ),
13- ...map(
15+ map(
1416 (module) => module.services.map(m => m.default),
1517 bulk(__dirname, '*/services/*.js')
1618 )
17-}
19+)
1820
1921 export default module.exports = createApi
2022
2123 function createApi (config) {
2224 const app = feathers()
2325 .configure(rest())
24- .configure(hooks())
2526 .use(bodyParser.json())
2627 .use(bodyParser.urlencoded({ extended: true }))
28+ .configure(hooks())
2729
2830 useAll(app, services)
2931
3032 return app
app/todos/service.jsView
@@ -7,10 +7,10 @@
77
88 export default knexService({
99 Model: db,
1010 name: 'todos'
11-}).extend({
12- setup: function (app) {
13- this._super && this._super(app)
14- validate(app.service('todos'), Todo)
15- }
1611 })
12+//.extend({
13+// setup: function (app) {
14+// validate(app.service('todos'), Todo)
15+// }
16+//})
config/development.jsView
@@ -1,10 +1,17 @@
11 const join = require('path').join
22
33 module.exports = {
44 db: {
5- client: 'sqlite3',
5+ client: 'pg',
66 connection: {
7- filename: join(__dirname, '..', 'db.sqlite')
7+ host : 'localhost',
8+ user : 'postgres',
9+ //password : 'postgres',
10+ database : 'postgres'
11+ },
12+ pool: {
13+ min: 0,
14+ max: 1
815 }
916 }
1017 }
package.jsonView
@@ -2,8 +2,9 @@
22 "name": "business-stack",
33 "version": "0.0.0",
44 "description": "real-world production-quality TodoMVC example",
55 "scripts": {
6+ "knex": "knex",
67 "postinstall": "lnfs app node_modules/app",
78 "lint": "snazzy",
89 "format": "snazzy --format",
910 "test": "npm-run-all -p test:*",
@@ -61,8 +62,9 @@
6162 "babel-plugin-react-transform": "^2.0.0",
6263 "browserify-hmr": "^0.3.1",
6364 "cuke-tap": "^1.0.2",
6465 "ecstatic-lr": "^1.0.1",
66+ "feathers-memory": "^0.5.1",
6567 "garnish": "^5.0.1",
6668 "glob": "^6.0.2",
6769 "jsdom": "^7.1.0",
6870 "node-dev": "^2.7.1",
@@ -95,15 +97,17 @@
9597 "cssify": "github:ahdinosaur/cssify",
9698 "ecstatic": "^1.4.0",
9799 "envify": "^3.4.0",
98100 "evalify": "^1.0.1",
99- "feathers": "^1.2.0",
101+ "feathers": "^2.0.0-pre.1",
100102 "feathers-hooks": "^0.5.1",
103+ "feathers-knex": "^2.0.0",
101104 "feathers-rest": "^1.0.0",
102105 "feathers-tcomb": "^1.0.0",
103106 "history": "^1.13.1",
104107 "lnfs-cli": "^1.0.1",
105108 "npm-run-all": "^1.3.2",
109+ "pg": "^4.4.3",
106110 "pinkie-promise": "^2.0.0",
107111 "predirect": "^1.1.0",
108112 "ramda": "^0.18.0",
109113 "react": "^0.14.3",
knexfile.jsView
@@ -1,0 +1,1 @@
1+module.exports = require('app/config').db
migrations/20160108004846_create_todos.jsView
@@ -1,0 +1,11 @@
1+exports.up = function(knex, Promise) {
2+ return knex.schema.createTableIfNotExists('todos', function(table) {
3+ table.increments('id')
4+ table.string('text')
5+ table.boolean('complete')
6+ })
7+}
8+
9+exports.down = function(knex, Promise) {
10+ return knex.schema.dropTableIfExists('todos')
11+}

Built with git-ssb-web