Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(hapi): enable account component
* * * This commit was sponsored by &yet. Our friends at &yet have been supporters of Hoodie since its earliest days. <3 And they have availability for new projects! We think they’re some of the best people you can hire anywhere, but you can read what other people have to say about them and their work here: https://andyet.com/case-studies/
- Loading branch information
Showing
3 changed files
with
31 additions
and
37 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,32 @@ | ||
// var _ = require('lodash') | ||
// var PouchDB = require('pouchdb') | ||
module.exports = function (config, usersDbName, callback) { | ||
var database = require('./database')(config) | ||
var usersDb = database(usersDbName) | ||
|
||
module.exports = function (config, usersDb, callback) { | ||
// var users = new PouchDB(usersDb) | ||
// users.plugin(require('pouchdb-users')) | ||
// users.installUsersBehavior() | ||
// .then(function () { | ||
// var defaultOpts = { | ||
// config: config, | ||
// database: require('./database')(config), | ||
// prefix: '/hoodie/account', | ||
// users: users | ||
// } | ||
// | ||
// // insert below code here | ||
// }, callback) | ||
usersDb.constructor.plugin(require('pouchdb-users')) | ||
|
||
callback(null, [ | ||
require('inert'), | ||
require('h2o2') | ||
].concat([ | ||
require('./static'), | ||
require('./http-log') | ||
].map(function (plugin) { | ||
return { | ||
register: plugin, | ||
options: {config: config} | ||
} | ||
})/*, [{ | ||
register: require('@hoodie/server-account-node-sessions'), | ||
options: defaultOpts | ||
}, { | ||
register: require('hoodie-server-store'), | ||
options: _.defaults({prefix: '/hoodie/store'}, defaultOpts) | ||
}]*/)) | ||
usersDb.installUsersBehavior().then(function () { | ||
var options = {config, usersDb} | ||
|
||
var hapiPlugins = [ | ||
require('h2o2'), | ||
require('inert') | ||
] | ||
|
||
var localPlugins = [ | ||
require('./http-log'), | ||
require('./static') | ||
].map(function (register) { return {options, register} }) | ||
|
||
var hoodieCorePlugins = [{ | ||
options, | ||
register: require('hoodie-server-account'), | ||
routes: {prefix: '/hoodie/account'} | ||
// }, { | ||
// options, | ||
// register: require('hoodie-server-store'), | ||
// routes: {prefix: '/hoodie/store'} | ||
}] | ||
|
||
callback(null, hapiPlugins.concat(localPlugins, hoodieCorePlugins)) | ||
}, callback) | ||
} |
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
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