Skip to content

Commit

Permalink
some boring breaking changes (#66)
Browse files Browse the repository at this point in the history
- move all authentication code to `dogstack-agents`
  - rename `auth` config key to `authentication`
- add `feathers-rest` transport
- move app services to run before static assets and bundler services
  • Loading branch information
ahdinosaur authored Jul 2, 2017
1 parent 183d66e commit 912d5a5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 29 deletions.
7 changes: 0 additions & 7 deletions createClient.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const feathers = require('feathers/client')
const socketio = require('feathers-socketio/client')
const hooks = require('feathers-hooks')
const auth = require('feathers-authentication-client')
const rx = require('feathers-reactive')
const Rx = require('rxjs')
const io = require('socket.io-client')
Expand All @@ -13,18 +12,12 @@ function createClient (options) {
services = []
} = options

const localStorage = window ? window.localStorage : null

const socket = io()

const client = feathers()
.configure(socketio(socket))
.configure(hooks())
.configure(rx(Rx))
.configure(auth({
storage: localStorage,
accessTokenKey: 'dogstack'
}))

services.map(service => {
client.configure(service)
Expand Down
34 changes: 15 additions & 19 deletions createServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ const favicon = require('serve-favicon')
const errorHandler = require('feathers-errors/handler')
const configuration = require('feathers-configuration')
const hooks = require('feathers-hooks')
const rest = require('feathers-rest')
const socketio = require('feathers-socketio')
const authentication = require('feathers-authentication')

const createBundler = require('./createBundler')

Expand Down Expand Up @@ -48,6 +48,20 @@ function createServer (options) {
assert(faviconConfig, 'must set `favicon` in config. example: "app/favicon.ico"')
app.use(favicon(faviconConfig))

// feathers hooks
app.configure(hooks())

// transports
app.configure(rest())
app.configure(socketio({
wsEngine: 'uws'
}))

// services (plugins)
services.forEach(service => {
app.configure(service)
})

// static files
const assetsConfig = app.get('assets')
assert(assetsConfig, 'must set `assets` in config. example: "assets"')
Expand All @@ -74,24 +88,6 @@ function createServer (options) {
}
app.use(createBundler(merge(defaultBundlerConfig, bundlerConfig)))

// feathers hooks
app.configure(hooks())

// transports
app.configure(socketio({
wsEngine: 'uws'
}))

// authentication
const authConfig = app.get('auth')
assert(authConfig, 'must set `auth` in config.')
app.configure(authentication(authConfig))

// services (plugins)
services.forEach(service => {
app.configure(service)
})

// log errors
app.use(function (err, req, res, next) {
if (err) console.error('error', err)
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dogstack",
"version": "0.2.2",
"version": "0.3.0-pre.0",
"description": "a popular-choice grab-bag framework for teams working on production web apps",
"main": "index.js",
"browser": "browser.js",
Expand Down Expand Up @@ -50,12 +50,11 @@
"compression": "^1.6.2",
"es2040": "^1.2.5",
"feathers": "^2.1.2",
"feathers-authentication": "^1.2.3",
"feathers-authentication-client": "^0.3.2",
"feathers-configuration": "^0.4.1",
"feathers-errors": "^2.8.0",
"feathers-hooks": "^2.0.1",
"feathers-reactive": "^0.4.1",
"feathers-rest": "^1.7.3",
"feathers-socketio": "^2.0.0",
"fela-beautifier": "^4.3.5",
"fela-font-renderer": "^4.3.5",
Expand Down

0 comments on commit 912d5a5

Please sign in to comment.