userific-server
v0.1.6
Published
A restful api server to manage users in your application. The server can be used with any userfic backends.
Downloads
9
Readme
Userfic Server
A restful api server to manage users in your application. The server can be used with any userfic backends.
Installation
npm install -S userific-server
Setup
To setup the server you need to supply a properly configured userific backend
var userificServer = require('userific-server')
var mongooseBackend = require('userific-mongoose')
var config = {
database: 'fooDatabase',
username: 'fooUsername',
password: 'fooPassword'
}
// instatiate a mongoose userific backend which stores user data in a MongoDB database
var backend = mongooseBackend(config)
// pass the backend in as a parameter. Note that server here is an instance of restify.createServer
var server = userificServer(backend, serverConfig)
// start the server on port 3000
var port = 3000
server.listen(3000)
When creating the server in the example above, serverConfig
is the configuration object that is passed to restify.createServer
. Restify Documentation. For example if you wish to create an https server, pass the certificate and key objects
var userificServer = require('userific-server')
var backend = {} //some instatiated userific backend
var serverConfig = {
certificate: 'PEM-encoded certificate string here',
key: 'PEM-encoded key string here'
}
var server = userificServer(backend, serverConfig)
Routes
For example say the server is listening on host: localhost
, port: 3000
and is configured to use https
. Once the server is setup and listening on port 3000 the following routes are available.
https://localhost:3000/register
https://localhost:3000/authenticate
https://localhost:3000/changeEmail
https://localhost:3000/changePassword
Register
To register a new user