{"_id":"userific-server","_rev":"27-1ab23a0833e87cce1a87324127afcb65","name":"userific-server","description":"A restful api server to manage users in your application. The server can be used with any userfic backends.","dist-tags":{"latest":"0.1.6"},"versions":{"0.0.1":{"name":"userific-server","version":"0.0.1","description":"A restful api server to manage users in your application. The server can be used with any userfic backends.","main":"index.js","directories":{"test":"test"},"scripts":{"test":"make test"},"repository":{"type":"git","url":"git://github.com/nisaacson/userific-server.git"},"keywords":["userific","user","registeration","backend","api","rest","restify"],"author":{"name":"Noah Isaacson"},"license":"BSD","readmeFilename":"README.md","dependencies":{"restify":"~2.6.0","restify-validator":"~0.3.1"},"devDependencies":{"eyespect":"~0.1.10","should":"~1.2.2","mocha":"~1.11.0","request":"~2.21.0","clone-extend":"~0.1.2","cloneextend":"0.0.3","userific-mongoose":"0.0.5","mongoose":"~3.6.11","nconf":"~0.6.7","userific-test":"0.0.5"},"gitHead":"7a3b9dcb806745102c64e736c2b2149191078f79","bugs":{"url":"https://github.com/nisaacson/userific-server/issues"},"readme":"# Userfic Server\nA restful api server to manage users in your application. The server can be used with any userfic backends.\n\n# Installation\n\n```bash\nnpm install -S userific-server\n```\n\n# Setup\nTo setup the server you need to supply a properly configured userific backend\n\n```javascript\nvar userificServer = require('userific-server')\nvar mongooseBackend = require('userific-mongoose')\nvar config = {\n    database: 'fooDatabase',\n    username: 'fooUsername',\n    password: 'fooPassword'\n}\n\n// instatiate a mongoose userific backend which stores user data in a MongoDB database\nvar backend = mongooseBackend(config)\n\n// pass the backend in as a parameter. Note that server here is an instance of restify.createServer\nvar server = userificServer(backend, serverConfig)\n// start the server on port 3000\nvar port = 3000\nserver.listen(3000)\n```\n\n\nWhen creating the server in the example above, `serverConfig` is the configuration object that is passed to `restify.createServer`. [Restify Documentation](http://mcavage.github.io/node-restify/#Creating-a-Server). For example if you wish to create an https server, pass the certificate and key objects\n\n```javascript\nvar userificServer = require('userific-server')\nvar backend = {} //some instatiated userific backend\nvar serverConfig = {\n    certificate: 'PEM-encoded certificate string here',\n    key: 'PEM-encoded key string here'\n}\n\nvar server = userificServer(backend, serverConfig)\n```\n\n\n# Routes\nFor 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.\n\n* `https://localhost:3000/register`\n* `https://localhost:3000/authenticate`\n* `https://localhost:3000/changeEmail`\n* `https://localhost:3000/changePassword`\n\n\n\n## Register\n\nTo register a new user\n","_id":"userific-server@0.0.1","dist":{"shasum":"444d2257b28eafa36f0dffdabf5e8702d8011572","tarball":"https://registry.npmjs.org/userific-server/-/userific-server-0.0.1.tgz","integrity":"sha512-w3fOrVwrR0nfTgkVSj7ahObps/Y5aU1U3jU2+bHZKiSAocFNk46lRHuUGRDh851Zs4CLvnCzA7utfhNbUFzJGQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDxsObT+0o0XnisZXBhtp+uf7sGNV036qzGz1LwRP5J/QIgNEqznGyTepKfM9TPx3RMUlDOQILk+/UUPSUHb9eCiu8="}]},"_from":".","_npmVersion":"1.2.25","_npmUser":{"name":"clewfirst","email":"noah@nisaacson.com"},"maintainers":[{"name":"clewfirst","email":"noah@nisaacson.com"}]},"0.0.2":{"name":"userific-server","version":"0.0.2","description":"A restful api server to manage users in your application. The server can be used with any userfic backends.","main":"index.js","directories":{"test":"test"},"scripts":{"test":"make test"},"repository":{"type":"git","url":"git://github.com/nisaacson/userific-server.git"},"keywords":["userific","user","registeration","backend","api","rest","restify"],"author":{"name":"Noah Isaacson"},"license":"BSD","readmeFilename":"README.md","dependencies":{"restify":"~2.6.0","restify-validator":"~0.3.1"},"devDependencies":{"eyespect":"~0.1.10","should":"~1.2.2","mocha":"~1.11.0","request":"~2.21.0","clone-extend":"~0.1.2","cloneextend":"0.0.3","userific-mongoose":"0.0.5","mongoose":"~3.6.11","nconf":"~0.6.7","userific-test":"0.0.5"},"gitHead":"7a3b9dcb806745102c64e736c2b2149191078f79","bugs":{"url":"https://github.com/nisaacson/userific-server/issues"},"readme":"# Userfic Server\nA restful api server to manage users in your application. The server can be used with any userfic backends.\n\n# Installation\n\n```bash\nnpm install -S userific-server\n```\n\n# Setup\nTo setup the server you need to supply a properly configured userific backend\n\n```javascript\nvar userificServer = require('userific-server')\nvar mongooseBackend = require('userific-mongoose')\nvar config = {\n    database: 'fooDatabase',\n    username: 'fooUsername',\n    password: 'fooPassword'\n}\n\n// instatiate a mongoose userific backend which stores user data in a MongoDB database\nvar backend = mongooseBackend(config)\n\n// pass the backend in as a parameter. Note that server here is an instance of restify.createServer\nvar server = userificServer(backend, serverConfig)\n// start the server on port 3000\nvar port = 3000\nserver.listen(3000)\n```\n\n\nWhen creating the server in the example above, `serverConfig` is the configuration object that is passed to `restify.createServer`. [Restify Documentation](http://mcavage.github.io/node-restify/#Creating-a-Server). For example if you wish to create an https server, pass the certificate and key objects\n\n```javascript\nvar userificServer = require('userific-server')\nvar backend = {} //some instatiated userific backend\nvar serverConfig = {\n    certificate: 'PEM-encoded certificate string here',\n    key: 'PEM-encoded key string here'\n}\n\nvar server = userificServer(backend, serverConfig)\n```\n\n\n# Routes\nFor 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.\n\n* `https://localhost:3000/register`\n* `https://localhost:3000/authenticate`\n* `https://localhost:3000/changeEmail`\n* `https://localhost:3000/changePassword`\n\n\n\n## Register\n\nTo register a new user\n","_id":"userific-server@0.0.2","dist":{"shasum":"8f49341ed05fb23598e4f94256b9bd948455fd1c","tarball":"https://registry.npmjs.org/userific-server/-/userific-server-0.0.2.tgz","integrity":"sha512-u7rJ/naGUyigA8p1nWUOo8NsOi4mVH2vOiCY4HPlo7zWzj+B6YRxI30KvP931tEnXqF31DrxxuYUQNc7wY7Hfw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIA+ByES6dDqA0I7SmCj8W9tEMluYQE12WLDjIDTvEP1LAiAHm4ohDznh8CAPaI043oGHTLKTprmhcoDRi2QvFr56aw=="}]},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"clewfirst","email":"noah@nisaacson.com"},"maintainers":[{"name":"clewfirst","email":"noah@nisaacson.com"}]},"0.0.3":{"name":"userific-server","version":"0.0.3","description":"A restful api server to manage users in your application. The server can be used with any userfic backends.","main":"index.js","directories":{"test":"test"},"scripts":{"test":"make test"},"repository":{"type":"git","url":"git://github.com/nisaacson/userific-server.git"},"keywords":["userific","user","registeration","backend","api","rest","restify"],"author":{"name":"Noah Isaacson"},"license":"BSD","readmeFilename":"README.md","dependencies":{"restify":"~2.6.0","restify-validator":"~0.3.1"},"devDependencies":{"eyespect":"~0.1.10","should":"~1.2.2","mocha":"~1.11.0","request":"~2.21.0","clone-extend":"~0.1.2","cloneextend":"0.0.3","userific-mongoose":"0.0.7","mongoose":"~3.6.11","nconf":"~0.6.7","userific-test":"0.0.12","userific-postgres":"0.0.3"},"gitHead":"7a3b9dcb806745102c64e736c2b2149191078f79","bugs":{"url":"https://github.com/nisaacson/userific-server/issues"},"readme":"# Userfic Server\n[![Build Status](https://travis-ci.org/nisaacson/userific-server.png)](https://travis-ci.org/nisaacson/userific-server)\n\nA restful api server to manage users in your application. The server can be used with any userfic backends.\n\n# Installation\n\n```bash\nnpm install -S userific-server\n```\n\n# Setup\nTo setup the server you need to supply a properly configured userific backend\n\n```javascript\nvar userificServer = require('userific-server')\nvar mongooseBackend = require('userific-mongoose')\nvar config = {\n    database: 'fooDatabase',\n    username: 'fooUsername',\n    password: 'fooPassword'\n}\n\n// instatiate a mongoose userific backend which stores user data in a MongoDB database\nvar backend = mongooseBackend(config)\n\n// pass the backend in as a parameter. Note that server here is an instance of restify.createServer\nvar server = userificServer(backend, serverConfig)\n// start the server on port 3000\nvar port = 3000\nserver.listen(3000)\n```\n\n\nWhen creating the server in the example above, `serverConfig` is the configuration object that is passed to `restify.createServer`. [Restify Documentation](http://mcavage.github.io/node-restify/#Creating-a-Server). For example if you wish to create an https server, pass the certificate and key objects\n\n```javascript\nvar userificServer = require('userific-server')\nvar backend = {} //some instatiated userific backend\nvar serverConfig = {\n    certificate: 'PEM-encoded certificate string here',\n    key: 'PEM-encoded key string here'\n}\n\nvar server = userificServer(backend, serverConfig)\n```\n\n\n# Routes\nFor 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.\n\n* `https://localhost:3000/register`\n* `https://localhost:3000/confirmEmail`\n* `https://localhost:3000/authenticate`\n* `https://localhost:3000/changeEmail`\n* `https://localhost:3000/changePassword`\n* `https://localhost:3000/resetPassword`\n\nFor more information on the server api, consult the [apiary.io documentation here](http://docs.userificserver.apiary.io/)\n\n","_id":"userific-server@0.0.3","dist":{"shasum":"b20b3da1b5f3d6f7651165e8a272e93270bbc04e","tarball":"https://registry.npmjs.org/userific-server/-/userific-server-0.0.3.tgz","integrity":"sha512-dP3CXWJ0pkrHf0fqVLppe/Jh4p58Oe6Qv36Ypt2MBsFUflHG5vAQak43ugoL4L7LHKHSYYejVgknJio64UAD4A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIA9LrObqYb/kvIaL9C4GVRZsVxAa6EsvXnf+Dp0Gn3T/AiBPwMNUDIP+gWmON1PxYSmgMDtI8flf6EqxRQW4R9J49A=="}]},"_from":".","_npmVersion":"1.2.25","_npmUser":{"name":"clewfirst","email":"noah@nisaacson.com"},"maintainers":[{"name":"clewfirst","email":"noah@nisaacson.com"}]},"0.0.4":{"name":"userific-server","version":"0.0.4","description":"A restful api server to manage users in your application. The server can be used with any userfic backends.","main":"index.js","directories":{"test":"test"},"scripts":{"test":"make test"},"repository":{"type":"git","url":"git://github.com/nisaacson/userific-server.git"},"keywords":["userific","user","registeration","backend","api","rest","restify"],"author":{"name":"Noah Isaacson"},"license":"BSD","readmeFilename":"README.md","dependencies":{"restify":"~2.6.0","restify-validator":"~0.3.1","should":"~1.2.2"},"devDependencies":{"eyespect":"~0.1.10","should":"~1.2.2","mocha":"~1.11.0","request":"~2.21.0","clone-extend":"~0.1.2","cloneextend":"0.0.3","userific-mongoose":"0.0.7","mongoose":"~3.6.11","nconf":"~0.6.7","userific-test":"0.0.12","userific-postgres":"~0.1.0"},"gitHead":"7a3b9dcb806745102c64e736c2b2149191078f79","bugs":{"url":"https://github.com/nisaacson/userific-server/issues"},"readme":"# Userfic Server\n[![Build Status](https://travis-ci.org/nisaacson/userific-server.png)](https://travis-ci.org/nisaacson/userific-server)\n\nA restful api server to manage users in your application. The server can be used with any userfic backends.\n\n# Installation\n\n```bash\nnpm install -S userific-server\n```\n\n# Setup\nTo setup the server you need to supply a properly configured userific backend. When creating the server you need to supply your own callbacks to the `register` and `generatePasswordResetToken`. Both of these functions generate secret tokens which are used to confirm the user by their email address. The userific api server is intended to be a public-facing api so the tokens cannot be passed back directly to the user. Each callback will be passed the `req` (request),`res` (response) and the data provided by the backend after the work is complete\n\n```javascript\nvar userificServer = require('userific-server')\nvar mongooseBackend = require('userific-mongoose')\nvar config = {\n    database: 'fooDatabase',\n    username: 'fooUsername',\n    password: 'fooPassword'\n}\n\n// instatiate a mongoose userific backend which stores user data in a MongoDB database\nvar backend = mongooseBackend(config)\n\n\n/**\n * registerCallback\n * @param  {Stream} req  the incoming request from the client\n * @param  {Stream} res  the response stream used to send data  back to the client\n * @param  {Object} user the user data provided by the backend after the registration process is complete.\n *  the user ojbect contains the fields\n *   {\n *      email: \"foo@example.com\",\n *      _id: 'id of user in backend data-store',\n *     confirmToken: 'the token to email to the user so that they can confirm your account\n *   }\n */\nvar registerCallback = function(req, res, user) {\n  var email = user.email\n  var confirmToken = user.confirmToken\n  // email the confirm token to the user now\n  var confirmEmailLink = 'http://localhost:3000/confirmEmail?confirmToken=' + confirmToken\n  var emailBody = 'Thanks for registering a new account. Please click on the link below to confirm your email address and finish the registration process\\n' + confirmEmailLink\n  // send email here\n  mailer.send(email, emailBody, function(err) {\n    var outputError\n    if (err) {\n      outputError = new restify.InternalError('register completed correctly but failed to send)\n      outputError.body.error = err\n      outputError.body.reason = 'send_email_failed'\n      res.send(outputError)\n      return\n    }\n\n    // never send the confirmToken directly to the user\n    delete user.confirmToken\n    res.send(user)\n  })\n}\n\n/**\n * generatePasswordResetTokenCallback\n * @param  {Stream} req  the incoming request from the client\n * @param  {Stream} res  the response stream used to send data  back to the client\n * @param  {Object} user the user data provided by the backend after the registration process is complete.\n *  the user ojbect contains the fields\n *   {\n *      email: \"foo@example.com\",\n *      _id: 'id of user in backend data-store',\n *     confirmToken: 'the token to email to the user so that they can confirm your account\n *   }\n */\nvar generatePasswordResetTokenCallback = function(req, res, user) {\n  var email = user.email\n  var resetToken = user.resetToken\n  // email the confirm token to the user now\n  var resetLink = 'http://localhost:3000/resetPassword?resetToken=' + resetToken\n  var emailBody = 'You have requested to reset your password. Please click on the link below to reset your password\\n' + resetLink\n  // send email here\n  mailer.send(email, emailBody, function(err) {\n    var outputError\n    if (err) {\n      outputError = new restify.InternalError('generatePasswordResetToken completed correctly but failed to send email to user with reset link)\n      outputError.body.error = err\n      outputError.body.reason = 'send_email_failed'\n      res.send(outputError)\n      return\n    }\n\n    // never send the resetToken directly to the user\n    delete user.resetToken\n    res.send(user)\n  })\n}\n\n// pass the backend in as a parameter. Note that server here is an instance of restify.createServer\nvar server = userificServer(backend, serverConfig, registerCallback, generatePasswordResetTokenCallback)\n// start the server on port 3000\nvar port = 3000\nserver.listen(3000)\n\n```\n\n\nWhen creating the server in the example above, `serverConfig` is the configuration object that is passed to `restify.createServer`. [Restify Documentation](http://mcavage.github.io/node-restify/#Creating-a-Server). For example if you wish to create an https server, pass the certificate and key objects\n\n```javascript\nvar userificServer = require('userific-server')\nvar backend = {} //some instatiated userific backend\nvar serverConfig = {\n    certificate: 'PEM-encoded certificate string here',\n    key: 'PEM-encoded key string here'\n}\n\nvar server = userificServer(backend, serverConfig)\n```\n\n\n# Routes\nFor 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.\n\n* `https://localhost:3000/register`\n* `https://localhost:3000/confirmEmail`\n* `https://localhost:3000/authenticate`\n* `https://localhost:3000/changeEmail`\n* `https://localhost:3000/changePassword`\n* `https://localhost:3000/resetPassword`\n\nFor more information on the server api, consult the [apiary.io documentation here](http://docs.userificserver.apiary.io/)\n\n","_id":"userific-server@0.0.4","dist":{"shasum":"7cf1caad809665b82a20536fdffb6f871e4bcf6a","tarball":"https://registry.npmjs.org/userific-server/-/userific-server-0.0.4.tgz","integrity":"sha512-FkYXMqMLOLMWFkRokfFBVGTd32NwAVImYpNvJYGASZkS0fQKrXBMFAhdhgIHMy+DXwaddQnnLFMcRKR8s/IdEw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBV38xSLXL+wfYT6YZMONrYdLCF57Ow/+DtirI5Mx5kWAiAF4tOAjur1peTOPRkG4ctXF/CjAfzC2EHnv9zC8+Pbdw=="}]},"_from":".","_npmVersion":"1.2.25","_npmUser":{"name":"clewfirst","email":"noah@nisaacson.com"},"maintainers":[{"name":"clewfirst","email":"noah@nisaacson.com"}]},"0.0.5":{"name":"userific-server","version":"0.0.5","description":"A restful api server to manage users in your application. The server can be used with any userfic backends.","main":"index.js","directories":{"test":"test"},"scripts":{"test":"make test"},"repository":{"type":"git","url":"git://github.com/nisaacson/userific-server.git"},"keywords":["userific","user","registeration","backend","api","rest","restify"],"author":{"name":"Noah Isaacson"},"license":"BSD","readmeFilename":"README.md","dependencies":{"restify":"~2.6.0","restify-validator":"~0.3.1","should":"~1.2.2"},"devDependencies":{"eyespect":"~0.1.10","should":"~1.2.2","mocha":"~1.11.0","request":"~2.21.0","clone-extend":"~0.1.2","cloneextend":"0.0.3","userific-mongoose":"0.0.7","mongoose":"~3.6.11","nconf":"~0.6.7","userific-test":"0.0.12","userific-postgres":"~0.1.1","optimist":"~0.5.2"},"gitHead":"7a3b9dcb806745102c64e736c2b2149191078f79","bugs":{"url":"https://github.com/nisaacson/userific-server/issues"},"readme":"# Userfic Server\n[![Build Status](https://travis-ci.org/nisaacson/userific-server.png)](https://travis-ci.org/nisaacson/userific-server)\n\nA restful api server to manage users in your application. The server can be used with any userfic backends.\n\n# Installation\n\n```bash\nnpm install -S userific-server\n```\n\n# Setup\nTo setup the server you need to supply a properly configured userific backend. When creating the server you need to supply your own callbacks to the `register` and `generatePasswordResetToken`. Both of these functions generate secret tokens which are used to confirm the user by their email address. The userific api server is intended to be a public-facing api so the tokens cannot be passed back directly to the user. Each callback will be passed the `req` (request),`res` (response) and the data provided by the backend after the work is complete\n\n```javascript\nvar restify = require('restify')\nvar nodemailer = require(\"nodemailer\");\nvar smtpTransport = nodemailer.createTransport(\"SMTP\",{\n    service: \"Gmail\",\n    auth: {\n        user: \"gmail.user@gmail.com\",\n        pass: \"userpass\"\n    }\n});\nvar userificServer = require('userific-server')\nvar mongooseBackend = require('userific-mongoose')\nvar config = {\n    database: 'fooDatabase',\n    username: 'fooUsername',\n    password: 'fooPassword'\n}\n\n// instatiate a mongoose userific backend which stores user data in a MongoDB database\nvar backend = mongooseBackend(config)\n\n\n/**\n * registerCallback\n * @param  {Stream} req  the incoming request from the client\n * @param  {Stream} res  the response stream used to send data  back to the client\n * @param  {Object} user the user data provided by the backend after the registration process is complete.\n *  the user ojbect contains the fields\n *   {\n *      email: \"foo@example.com\",\n *      _id: 'id of user in backend data-store',\n *     confirmToken: 'the token to email to the user so that they can confirm your account\n *   }\n */\nvar registerCallback = function(req, res, user) {\n  var email = user.email\n  var confirmToken = user.confirmToken\n  // email the confirm token to the user now\n  var confirmEmailLink = 'http://localhost:3000/confirmEmail?confirmToken=' + confirmToken\n  var emailBody = 'Thanks for registering a new account. Please click on the link below to confirm your email address and finish the registration process\\n' + confirmEmailLink\n  // send email here\n  var mailOptions = {\n    from: \"Fred Foo ✔ <info@example.com>\", // sender address\n    to: email, // list of receivers\n    subject: \"Hello ✔\", // Subject line\n    text: emailBody, // plaintext body\n    html: \"<b>Hello world ✔</b>\" // html body\n  }\n\n  // send mail with defined transport object\n  smtpTransport.sendMail(mailOptions, function(err, response){\n    var outputError\n    if (err) {\n      outputError = new restify.InternalError('register completed correctly but failed to send')\n      outputError.body.error = err\n      outputError.body.reason = 'send_email_failed'\n      res.send(outputError)\n      return\n    }\n    // never send the confirmToken directly to the user\n    delete user.confirmToken\n    res.send(user)\n  })\n}\n\n/**\n * generatePasswordResetTokenCallback\n * @param  {Stream} req  the incoming request from the client\n * @param  {Stream} res  the response stream used to send data  back to the client\n * @param  {Object} user the user data provided by the backend after the registration process is complete.\n *  the user ojbect contains the fields\n *   {\n *      email: \"foo@example.com\",\n *      _id: 'id of user in backend data-store',\n *     confirmToken: 'the token to email to the user so that they can confirm your account\n *   }\n */\nvar generatePasswordResetTokenCallback = function(req, res, user) {\n  var email = user.email\n  var resetToken = user.resetToken\n  // email the confirm token to the user now\n  var resetLink = 'http://localhost:3000/resetPassword?resetToken=' + resetToken\n  var emailBody = 'You have requested to reset your password. Please click on the link below to reset your password\\n' + resetLink\n  // send email here\n  var mailOptions = {\n    from: 'Fred Foo <info@example.com>', // sender address\n    to: email, // list of receivers\n    subject: 'Hello', // Subject line\n    text: emailBody, // plaintext body\n    html: '<b>Hello world</b>' // html body\n  }\n\n  // send mail with defined transport object\n  smtpTransport.sendMail(mailOptions, function(err, response){\n    var outputError\n    if (err) {\n      outputError = new restify.InternalError('generatePasswordResetToken completed correctly but failed to send email to user with reset link')\n      outputError.body.error = err\n      outputError.body.reason = 'send_email_failed'\n      res.send(outputError)\n      return\n    }\n\n    // never send the resetToken directly to the user\n    delete user.resetToken\n    res.send(user)\n  })\n}\n\n// pass the backend in as a parameter. Note that server here is an instance of restify.createServer\nvar server = userificServer(backend, serverConfig, registerCallback, generatePasswordResetTokenCallback)\n// start the server on port 3000\nvar port = 3000\nserver.listen(3000)\n\n```\n\n\nWhen creating the server in the example above, `serverConfig` is the configuration object that is passed to `restify.createServer`. [Restify Documentation](http://mcavage.github.io/node-restify/#Creating-a-Server). For example if you wish to create an https server, pass the certificate and key objects\n\n```javascript\nvar userificServer = require('userific-server')\nvar backend = {} //some instatiated userific backend\nvar serverConfig = {\n    certificate: 'PEM-encoded certificate string here',\n    key: 'PEM-encoded key string here'\n}\n\nvar server = userificServer(backend, serverConfig)\n```\n\n\n# Routes\nFor 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.\n\n* `https://localhost:3000/register`\n* `https://localhost:3000/confirmEmail`\n* `https://localhost:3000/authenticate`\n* `https://localhost:3000/changeEmail`\n* `https://localhost:3000/changePassword`\n* `https://localhost:3000/generatePasswordResetToken`\n* `https://localhost:3000/resetPassword`\n\nFor more information on the server api, consult the [apiary.io documentation here](http://docs.userificserver.apiary.io/)\n\n# Example\n\nAn example of how you might create your own userific server is included. Open the `./examples/` folder for more information\n\n","_id":"userific-server@0.0.5","dist":{"shasum":"03d86d9c4919c9eff8aca69925eff30bbe9073bb","tarball":"https://registry.npmjs.org/userific-server/-/userific-server-0.0.5.tgz","integrity":"sha512-rhy/SS/hBgh98CbQTPao4LPDxHUkRqm8poQc6455nCwleVZUibpE4ePQqVHM8VoqEfYuontdg9vF5kkeRKnHKw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCID+Jby5YZtoCnTmAunLUmGafH24gwFWFQ1zj5qVFYQOKAiAeByqqfpzx7ALHLPutjUwE3FAngi3qWapBcKIfJKJtgQ=="}]},"_from":".","_npmVersion":"1.3.0","_npmUser":{"name":"clewfirst","email":"noah@nisaacson.com"},"maintainers":[{"name":"clewfirst","email":"noah@nisaacson.com"}]},"0.1.0":{"name":"userific-server","version":"0.1.0","description":"A restful api server to manage users in your application. The server can be used with any userfic backends.","main":"index.js","directories":{"test":"test"},"scripts":{"test":"make test"},"repository":{"type":"git","url":"git://github.com/nisaacson/userific-server.git"},"keywords":["userific","user","registeration","backend","api","rest","restify"],"author":{"name":"Noah Isaacson"},"license":"BSD","readmeFilename":"README.md","dependencies":{"restify":"~2.6.0","restify-validator":"~0.3.1","should":"~1.2.2"},"devDependencies":{"eyespect":"~0.1.10","should":"~1.2.2","mocha":"~1.11.0","request":"~2.21.0","clone-extend":"~0.1.2","cloneextend":"0.0.3","userific-mongoose":"0.0.7","mongoose":"~3.6.11","nconf":"~0.6.7","userific-test":"0.0.12","userific-postgres":"~0.1.1","optimist":"~0.5.2"},"gitHead":"7a3b9dcb806745102c64e736c2b2149191078f79","bugs":{"url":"https://github.com/nisaacson/userific-server/issues"},"readme":"# Userfic Server\n[![Build Status](https://travis-ci.org/nisaacson/userific-server.png)](https://travis-ci.org/nisaacson/userific-server)\n\nA restful api server to manage users in your application. The server can be used with any userfic backends.\n\n# Installation\n\n```bash\nnpm install -S userific-server\n```\n\n# Setup\nTo setup the server you need to supply a properly configured userific backend. When creating the server you need to supply your own callbacks to the `register` and `generatePasswordResetToken`. Both of these functions generate secret tokens which are used to confirm the user by their email address. The userific api server is intended to be a public-facing api so the tokens cannot be passed back directly to the user. Each callback will be passed the `req` (request),`res` (response) and the data provided by the backend after the work is complete\n\n```javascript\nvar restify = require('restify')\nvar nodemailer = require(\"nodemailer\");\nvar smtpTransport = nodemailer.createTransport(\"SMTP\",{\n    service: \"Gmail\",\n    auth: {\n        user: \"gmail.user@gmail.com\",\n        pass: \"userpass\"\n    }\n});\nvar userificServer = require('userific-server')\nvar mongooseBackend = require('userific-mongoose')\nvar config = {\n    database: 'fooDatabase',\n    username: 'fooUsername',\n    password: 'fooPassword'\n}\n\n// instatiate a mongoose userific backend which stores user data in a MongoDB database\nvar backend = mongooseBackend(config)\n\n\n/**\n * registerCallback\n * @param  {Stream} req  the incoming request from the client\n * @param  {Stream} res  the response stream used to send data  back to the client\n * @param  {Object} user the user data provided by the backend after the registration process is complete.\n *  the user ojbect contains the fields\n *   {\n *      email: \"foo@example.com\",\n *      _id: 'id of user in backend data-store',\n *     confirmToken: 'the token to email to the user so that they can confirm your account\n *   }\n */\nvar registerCallback = function(req, res, user) {\n  var email = user.email\n  var confirmToken = user.confirmToken\n  // email the confirm token to the user now\n  var confirmEmailLink = 'http://localhost:3000/confirmEmail?confirmToken=' + confirmToken\n  var emailBody = 'Thanks for registering a new account. Please click on the link below to confirm your email address and finish the registration process\\n' + confirmEmailLink\n  // send email here\n  var mailOptions = {\n    from: \"Fred Foo ✔ <info@example.com>\", // sender address\n    to: email, // list of receivers\n    subject: \"Hello ✔\", // Subject line\n    text: emailBody, // plaintext body\n    html: \"<b>Hello world ✔</b>\" // html body\n  }\n\n  // send mail with defined transport object\n  smtpTransport.sendMail(mailOptions, function(err, response){\n    var outputError\n    if (err) {\n      outputError = new restify.InternalError('register completed correctly but failed to send')\n      outputError.body.error = err\n      outputError.body.reason = 'send_email_failed'\n      res.send(outputError)\n      return\n    }\n    // never send the confirmToken directly to the user\n    delete user.confirmToken\n    res.send(user)\n  })\n}\n\n/**\n * generatePasswordResetTokenCallback\n * @param  {Stream} req  the incoming request from the client\n * @param  {Stream} res  the response stream used to send data  back to the client\n * @param  {Object} user the user data provided by the backend after the registration process is complete.\n *  the user ojbect contains the fields\n *   {\n *      email: \"foo@example.com\",\n *      _id: 'id of user in backend data-store',\n *     confirmToken: 'the token to email to the user so that they can confirm your account\n *   }\n */\nvar generatePasswordResetTokenCallback = function(req, res, user) {\n  var email = user.email\n  var resetToken = user.resetToken\n  // email the confirm token to the user now\n  var resetLink = 'http://localhost:3000/resetPassword?resetToken=' + resetToken\n  var emailBody = 'You have requested to reset your password. Please click on the link below to reset your password\\n' + resetLink\n  // send email here\n  var mailOptions = {\n    from: 'Fred Foo <info@example.com>', // sender address\n    to: email, // list of receivers\n    subject: 'Hello', // Subject line\n    text: emailBody, // plaintext body\n    html: '<b>Hello world</b>' // html body\n  }\n\n  // send mail with defined transport object\n  smtpTransport.sendMail(mailOptions, function(err, response){\n    var outputError\n    if (err) {\n      outputError = new restify.InternalError('generatePasswordResetToken completed correctly but failed to send email to user with reset link')\n      outputError.body.error = err\n      outputError.body.reason = 'send_email_failed'\n      res.send(outputError)\n      return\n    }\n\n    // never send the resetToken directly to the user\n    delete user.resetToken\n    res.send(user)\n  })\n}\n\n// pass the backend in as a parameter. Note that server here is an instance of restify.createServer\nvar server = userificServer(backend, serverConfig, registerCallback, generatePasswordResetTokenCallback)\n// start the server on port 3000\nvar port = 3000\nserver.listen(3000)\n\n```\n\n\nWhen creating the server in the example above, `serverConfig` is the configuration object that is passed to `restify.createServer`. [Restify Documentation](http://mcavage.github.io/node-restify/#Creating-a-Server). For example if you wish to create an https server, pass the certificate and key objects\n\n```javascript\nvar userificServer = require('userific-server')\nvar backend = {} //some instatiated userific backend\nvar serverConfig = {\n    certificate: 'PEM-encoded certificate string here',\n    key: 'PEM-encoded key string here'\n}\n\nvar server = userificServer(backend, serverConfig)\n```\n\n\n# Routes\nFor 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.\n\n* `https://localhost:3000/register`\n* `https://localhost:3000/confirmEmail`\n* `https://localhost:3000/authenticate`\n* `https://localhost:3000/changeEmail`\n* `https://localhost:3000/changePassword`\n* `https://localhost:3000/generatePasswordResetToken`\n* `https://localhost:3000/resetPassword`\n\nFor more information on the server api, consult the [apiary.io documentation here](http://docs.userificserver.apiary.io/)\n\n# Example\n\nAn example of how you might create your own userific server is included. Open the `./examples/` folder for more information\n\n","_id":"userific-server@0.1.0","dist":{"shasum":"034d15b06568aadf4a75daf5ac5a8ca47195c97f","tarball":"https://registry.npmjs.org/userific-server/-/userific-server-0.1.0.tgz","integrity":"sha512-7uBj+PI3/4pQ6eeAGpkWqcKyUKxZj+Olkp1wy44W7LyLkd9cCT2HinU817NRIc43kXS+TE80yzq06L6bytdrOQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDgnEeRM9GXWm+BGbdC6WskHbPm28xxOC4X9EzlABNuHAIgeuGH1wv9og7pYed7ZOMXzETobSxQSWq/0pF+r2dj8Ko="}]},"_from":".","_npmVersion":"1.3.0","_npmUser":{"name":"clewfirst","email":"noah@nisaacson.com"},"maintainers":[{"name":"clewfirst","email":"noah@nisaacson.com"}]},"0.1.1":{"name":"userific-server","version":"0.1.1","description":"A restful api server to manage users in your application. The server can be used with any userfic backends.","main":"index.js","directories":{"test":"test"},"scripts":{"test":"make test"},"repository":{"type":"git","url":"git://github.com/nisaacson/userific-server.git"},"keywords":["userific","user","registeration","backend","api","rest","restify"],"author":{"name":"Noah Isaacson"},"license":"BSD","readmeFilename":"README.md","dependencies":{"restify":"~2.6.0","restify-validator":"~0.3.1","should":"~1.2.2"},"devDependencies":{"eyespect":"~0.1.10","should":"~1.2.2","mocha":"~1.11.0","request":"~2.21.0","clone-extend":"~0.1.2","cloneextend":"0.0.3","userific-mongoose":"0.0.7","mongoose":"~3.6.11","nconf":"~0.6.7","userific-test":"0.0.12","userific-postgres":"~0.1.1","optimist":"~0.5.2"},"gitHead":"7a3b9dcb806745102c64e736c2b2149191078f79","bugs":{"url":"https://github.com/nisaacson/userific-server/issues"},"readme":"# Userfic Server\n[![Build Status](https://travis-ci.org/nisaacson/userific-server.png)](https://travis-ci.org/nisaacson/userific-server)\n\nA restful api server to manage users in your application. The server can be used with any userfic backends.\n\n# Installation\n\n```bash\nnpm install -S userific-server\n```\n\n# Setup\nTo setup the server you need to supply a properly configured userific backend. When creating the server you need to supply your own callbacks to the `register` and `generatePasswordResetToken`. Both of these functions generate secret tokens which are used to confirm the user by their email address. The userific api server is intended to be a public-facing api so the tokens cannot be passed back directly to the user. Each callback will be passed the `req` (request),`res` (response) and the data provided by the backend after the work is complete\n\n```javascript\nvar restify = require('restify')\nvar nodemailer = require(\"nodemailer\");\nvar smtpTransport = nodemailer.createTransport(\"SMTP\",{\n    service: \"Gmail\",\n    auth: {\n        user: \"gmail.user@gmail.com\",\n        pass: \"userpass\"\n    }\n});\nvar userificServer = require('userific-server')\nvar mongooseBackend = require('userific-mongoose')\nvar config = {\n    database: 'fooDatabase',\n    username: 'fooUsername',\n    password: 'fooPassword'\n}\n\n// instatiate a mongoose userific backend which stores user data in a MongoDB database\nvar backend = mongooseBackend(config)\n\n\n/**\n * registerCallback\n * @param  {Stream} req  the incoming request from the client\n * @param  {Stream} res  the response stream used to send data  back to the client\n * @param  {Object} user the user data provided by the backend after the registration process is complete.\n *  the user ojbect contains the fields\n *   {\n *      email: \"foo@example.com\",\n *      _id: 'id of user in backend data-store',\n *     confirmToken: 'the token to email to the user so that they can confirm your account\n *   }\n */\nvar registerCallback = function(req, res, user) {\n  var email = user.email\n  var confirmToken = user.confirmToken\n  // email the confirm token to the user now\n  var confirmEmailLink = 'http://localhost:3000/confirmEmail?confirmToken=' + confirmToken\n  var emailBody = 'Thanks for registering a new account. Please click on the link below to confirm your email address and finish the registration process\\n' + confirmEmailLink\n  // send email here\n  var mailOptions = {\n    from: \"Fred Foo ✔ <info@example.com>\", // sender address\n    to: email, // list of receivers\n    subject: \"Hello ✔\", // Subject line\n    text: emailBody, // plaintext body\n    html: \"<b>Hello world ✔</b>\" // html body\n  }\n\n  // send mail with defined transport object\n  smtpTransport.sendMail(mailOptions, function(err, response){\n    var outputError\n    if (err) {\n      outputError = new restify.InternalError('register completed correctly but failed to send')\n      outputError.body.error = err\n      outputError.body.reason = 'send_email_failed'\n      res.send(outputError)\n      return\n    }\n    // never send the confirmToken directly to the user\n    delete user.confirmToken\n    res.send(user)\n  })\n}\n\n/**\n * generatePasswordResetTokenCallback\n * @param  {Stream} req  the incoming request from the client\n * @param  {Stream} res  the response stream used to send data  back to the client\n * @param  {Object} user the user data provided by the backend after the registration process is complete.\n *  the user ojbect contains the fields\n *   {\n *      email: \"foo@example.com\",\n *      _id: 'id of user in backend data-store',\n *     confirmToken: 'the token to email to the user so that they can confirm your account\n *   }\n */\nvar generatePasswordResetTokenCallback = function(req, res, user) {\n  var email = user.email\n  var resetToken = user.resetToken\n  // email the confirm token to the user now\n  var resetLink = 'http://localhost:3000/resetPassword?resetToken=' + resetToken\n  var emailBody = 'You have requested to reset your password. Please click on the link below to reset your password\\n' + resetLink\n  // send email here\n  var mailOptions = {\n    from: 'Fred Foo <info@example.com>', // sender address\n    to: email, // list of receivers\n    subject: 'Hello', // Subject line\n    text: emailBody, // plaintext body\n    html: '<b>Hello world</b>' // html body\n  }\n\n  // send mail with defined transport object\n  smtpTransport.sendMail(mailOptions, function(err, response){\n    var outputError\n    if (err) {\n      outputError = new restify.InternalError('generatePasswordResetToken completed correctly but failed to send email to user with reset link')\n      outputError.body.error = err\n      outputError.body.reason = 'send_email_failed'\n      res.send(outputError)\n      return\n    }\n\n    // never send the resetToken directly to the user\n    delete user.resetToken\n    res.send(user)\n  })\n}\n\n// pass the backend in as a parameter. Note that server here is an instance of restify.createServer\nvar server = userificServer(backend, serverConfig, registerCallback, generatePasswordResetTokenCallback)\n// start the server on port 3000\nvar port = 3000\nserver.listen(3000)\n\n```\n\n\nWhen creating the server in the example above, `serverConfig` is the configuration object that is passed to `restify.createServer`. [Restify Documentation](http://mcavage.github.io/node-restify/#Creating-a-Server). For example if you wish to create an https server, pass the certificate and key objects\n\n```javascript\nvar userificServer = require('userific-server')\nvar backend = {} //some instatiated userific backend\nvar serverConfig = {\n    certificate: 'PEM-encoded certificate string here',\n    key: 'PEM-encoded key string here'\n}\n\nvar server = userificServer(backend, serverConfig)\n```\n\n\n# Routes\nFor 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.\n\n* `https://localhost:3000/register`\n* `https://localhost:3000/confirmEmail`\n* `https://localhost:3000/authenticate`\n* `https://localhost:3000/changeEmail`\n* `https://localhost:3000/changePassword`\n* `https://localhost:3000/generatePasswordResetToken`\n* `https://localhost:3000/resetPassword`\n\nFor more information on the server api, consult the [apiary.io documentation here](http://docs.userificserver.apiary.io/)\n\n# Example\n\nAn example of how you might create your own userific server is included. Open the `./examples/` folder for more information\n\n","_id":"userific-server@0.1.1","dist":{"shasum":"54b5640d8c00a479a9a87c73ab3b53cf3699ad2e","tarball":"https://registry.npmjs.org/userific-server/-/userific-server-0.1.1.tgz","integrity":"sha512-WlkUASRDjeUgBfJ9XmOnKRtCfj2bpoafwuzxZNlzKk9ju+9bPfbgReMeXNKlxWpFeutLVoa8Dnderl3nI748og==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCL5hn39CfsATEkgVnl/zMF/ZKgovcVDKfrZ38F23lm2QIhAK/uHALxcp5awjP3oWaxDwMzcu85SuACBfr9Det+QLH+"}]},"_from":".","_npmVersion":"1.3.0","_npmUser":{"name":"clewfirst","email":"noah@nisaacson.com"},"maintainers":[{"name":"clewfirst","email":"noah@nisaacson.com"}]},"0.1.2":{"name":"userific-server","version":"0.1.2","description":"A restful api server to manage users in your application. The server can be used with any userfic backends.","main":"index.js","directories":{"test":"test"},"scripts":{"test":"make test"},"repository":{"type":"git","url":"git://github.com/nisaacson/userific-server.git"},"keywords":["userific","user","registeration","backend","api","rest","restify"],"author":{"name":"Noah Isaacson"},"license":"BSD","readmeFilename":"README.md","dependencies":{"restify":"~2.6.0","restify-validator":"~0.3.1","should":"~1.2.2"},"devDependencies":{"eyespect":"~0.1.10","should":"~1.2.2","mocha":"~1.11.0","request":"~2.21.0","clone-extend":"~0.1.2","cloneextend":"0.0.3","userific-mongoose":"0.0.7","mongoose":"~3.6.11","nconf":"~0.6.7","userific-test":"0.0.12","userific-postgres":"~0.1.1","optimist":"~0.5.2"},"gitHead":"7a3b9dcb806745102c64e736c2b2149191078f79","bugs":{"url":"https://github.com/nisaacson/userific-server/issues"},"readme":"# Userfic Server\n[![Build Status](https://travis-ci.org/nisaacson/userific-server.png)](https://travis-ci.org/nisaacson/userific-server)\n\nA restful api server to manage users in your application. The server can be used with any userfic backends.\n\n# Installation\n\n```bash\nnpm install -S userific-server\n```\n\n# Setup\nTo setup the server you need to supply a properly configured userific backend. When creating the server you need to supply your own callbacks to the `register` and `generatePasswordResetToken`. Both of these functions generate secret tokens which are used to confirm the user by their email address. The userific api server is intended to be a public-facing api so the tokens cannot be passed back directly to the user. Each callback will be passed the `req` (request),`res` (response) and the data provided by the backend after the work is complete\n\n```javascript\nvar restify = require('restify')\nvar nodemailer = require(\"nodemailer\");\nvar smtpTransport = nodemailer.createTransport(\"SMTP\",{\n    service: \"Gmail\",\n    auth: {\n        user: \"gmail.user@gmail.com\",\n        pass: \"userpass\"\n    }\n});\nvar userificServer = require('userific-server')\nvar mongooseBackend = require('userific-mongoose')\nvar config = {\n    database: 'fooDatabase',\n    username: 'fooUsername',\n    password: 'fooPassword'\n}\n\n// instatiate a mongoose userific backend which stores user data in a MongoDB database\nvar backend = mongooseBackend(config)\n\n\n/**\n * registerCallback\n * @param  {Stream} req  the incoming request from the client\n * @param  {Stream} res  the response stream used to send data  back to the client\n * @param  {Object} user the user data provided by the backend after the registration process is complete.\n *  the user ojbect contains the fields\n *   {\n *      email: \"foo@example.com\",\n *      _id: 'id of user in backend data-store',\n *     confirmToken: 'the token to email to the user so that they can confirm your account\n *   }\n */\nvar registerCallback = function(req, res, user) {\n  var email = user.email\n  var confirmToken = user.confirmToken\n  // email the confirm token to the user now\n  var confirmEmailLink = 'http://localhost:3000/confirmEmail?confirmToken=' + confirmToken\n  var emailBody = 'Thanks for registering a new account. Please click on the link below to confirm your email address and finish the registration process\\n' + confirmEmailLink\n  // send email here\n  var mailOptions = {\n    from: \"Fred Foo ✔ <info@example.com>\", // sender address\n    to: email, // list of receivers\n    subject: \"Hello ✔\", // Subject line\n    text: emailBody, // plaintext body\n    html: \"<b>Hello world ✔</b>\" // html body\n  }\n\n  // send mail with defined transport object\n  smtpTransport.sendMail(mailOptions, function(err, response){\n    var outputError\n    if (err) {\n      outputError = new restify.InternalError('register completed correctly but failed to send')\n      outputError.body.error = err\n      outputError.body.reason = 'send_email_failed'\n      res.send(outputError)\n      return\n    }\n    // never send the confirmToken directly to the user\n    delete user.confirmToken\n    res.send(user)\n  })\n}\n\n/**\n * generatePasswordResetTokenCallback\n * @param  {Stream} req  the incoming request from the client\n * @param  {Stream} res  the response stream used to send data  back to the client\n * @param  {Object} user the user data provided by the backend after the registration process is complete.\n *  the user ojbect contains the fields\n *   {\n *      email: \"foo@example.com\",\n *      _id: 'id of user in backend data-store',\n *     confirmToken: 'the token to email to the user so that they can confirm your account\n *   }\n */\nvar generatePasswordResetTokenCallback = function(req, res, user) {\n  var email = user.email\n  var resetToken = user.resetToken\n  // email the confirm token to the user now\n  var resetLink = 'http://localhost:3000/resetPassword?resetToken=' + resetToken\n  var emailBody = 'You have requested to reset your password. Please click on the link below to reset your password\\n' + resetLink\n  // send email here\n  var mailOptions = {\n    from: 'Fred Foo <info@example.com>', // sender address\n    to: email, // list of receivers\n    subject: 'Hello', // Subject line\n    text: emailBody, // plaintext body\n    html: '<b>Hello world</b>' // html body\n  }\n\n  // send mail with defined transport object\n  smtpTransport.sendMail(mailOptions, function(err, response){\n    var outputError\n    if (err) {\n      outputError = new restify.InternalError('generatePasswordResetToken completed correctly but failed to send email to user with reset link')\n      outputError.body.error = err\n      outputError.body.reason = 'send_email_failed'\n      res.send(outputError)\n      return\n    }\n\n    // never send the resetToken directly to the user\n    delete user.resetToken\n    res.send(user)\n  })\n}\n\n// pass the backend in as a parameter. Note that server here is an instance of restify.createServer\nvar server = userificServer(backend, serverConfig, registerCallback, generatePasswordResetTokenCallback)\n// start the server on port 3000\nvar port = 3000\nserver.listen(3000)\n\n```\n\n\nWhen creating the server in the example above, `serverConfig` is the configuration object that is passed to `restify.createServer`. [Restify Documentation](http://mcavage.github.io/node-restify/#Creating-a-Server). For example if you wish to create an https server, pass the certificate and key objects\n\n```javascript\nvar userificServer = require('userific-server')\nvar backend = {} //some instatiated userific backend\nvar serverConfig = {\n    certificate: 'PEM-encoded certificate string here',\n    key: 'PEM-encoded key string here'\n}\n\nvar server = userificServer(backend, serverConfig)\n```\n\n\n# Routes\nFor 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.\n\n* `https://localhost:3000/register`\n* `https://localhost:3000/confirmEmail`\n* `https://localhost:3000/authenticate`\n* `https://localhost:3000/changeEmail`\n* `https://localhost:3000/changePassword`\n* `https://localhost:3000/generatePasswordResetToken`\n* `https://localhost:3000/resetPassword`\n\nFor more information on the server api, consult the [apiary.io documentation here](http://docs.userificserver.apiary.io/)\n\n# Example\n\nAn example of how you might create your own userific server is included. Open the `./examples/` folder for more information\n\n","_id":"userific-server@0.1.2","dist":{"shasum":"89df0adfa4a676535469089d9d856a4a1dd2f702","tarball":"https://registry.npmjs.org/userific-server/-/userific-server-0.1.2.tgz","integrity":"sha512-YwDtoUnQJzkrVnnFy1WhqrKGtu1jJ+pjfS0HWN0qMHvriZdBz6ym2xkXjeMcdlO5YjB3o+z+BhqCa0uFLM0pyw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBIwhscdxaS5IDEERZNQXARicWAFlbqG6QHU+BuRLs7gAiACOEfRyUDmkyXwQcLIASHdnzKKQmhNrAHfVxDAsj+rLg=="}]},"_from":".","_npmVersion":"1.3.0","_npmUser":{"name":"clewfirst","email":"noah@nisaacson.com"},"maintainers":[{"name":"clewfirst","email":"noah@nisaacson.com"}]},"0.1.3":{"name":"userific-server","version":"0.1.3","description":"A restful api server to manage users in your application. The server can be used with any userfic backends.","main":"index.js","directories":{"test":"test"},"scripts":{"test":"make test"},"repository":{"type":"git","url":"git://github.com/nisaacson/userific-server.git"},"keywords":["userific","user","registeration","backend","api","rest","restify"],"author":{"name":"Noah Isaacson"},"license":"BSD","readmeFilename":"README.md","dependencies":{"restify":"~2.6.0","restify-validator":"~0.3.1","should":"~1.2.2"},"devDependencies":{"eyespect":"~0.1.10","should":"~1.2.2","mocha":"~1.11.0","request":"~2.21.0","clone-extend":"~0.1.2","cloneextend":"0.0.3","userific-mongoose":"0.0.7","mongoose":"~3.6.11","nconf":"~0.6.7","userific-test":"0.0.12","userific-postgres":"~0.1.1","optimist":"~0.5.2"},"gitHead":"7a3b9dcb806745102c64e736c2b2149191078f79","bugs":{"url":"https://github.com/nisaacson/userific-server/issues"},"readme":"# Userfic Server\n[![Build Status](https://travis-ci.org/nisaacson/userific-server.png)](https://travis-ci.org/nisaacson/userific-server)\n\nA restful api server to manage users in your application. The server can be used with any userfic backends.\n\n# Installation\n\n```bash\nnpm install -S userific-server\n```\n\n# Setup\nTo setup the server you need to supply a properly configured userific backend. When creating the server you need to supply your own callbacks to the `register` and `generatePasswordResetToken`. Both of these functions generate secret tokens which are used to confirm the user by their email address. The userific api server is intended to be a public-facing api so the tokens cannot be passed back directly to the user. Each callback will be passed the `req` (request),`res` (response) and the data provided by the backend after the work is complete\n\n```javascript\nvar restify = require('restify')\nvar nodemailer = require(\"nodemailer\");\nvar smtpTransport = nodemailer.createTransport(\"SMTP\",{\n    service: \"Gmail\",\n    auth: {\n        user: \"gmail.user@gmail.com\",\n        pass: \"userpass\"\n    }\n});\nvar userificServer = require('userific-server')\nvar mongooseBackend = require('userific-mongoose')\nvar config = {\n    database: 'fooDatabase',\n    username: 'fooUsername',\n    password: 'fooPassword'\n}\n\n// instatiate a mongoose userific backend which stores user data in a MongoDB database\nvar backend = mongooseBackend(config)\n\n\n/**\n * registerCallback\n * @param  {Stream} req  the incoming request from the client\n * @param  {Stream} res  the response stream used to send data  back to the client\n * @param  {Object} user the user data provided by the backend after the registration process is complete.\n *  the user ojbect contains the fields\n *   {\n *      email: \"foo@example.com\",\n *      _id: 'id of user in backend data-store',\n *     confirmToken: 'the token to email to the user so that they can confirm your account\n *   }\n */\nvar registerCallback = function(req, res, user) {\n  var email = user.email\n  var confirmToken = user.confirmToken\n  // email the confirm token to the user now\n  var confirmEmailLink = 'http://localhost:3000/confirmEmail?confirmToken=' + confirmToken\n  var emailBody = 'Thanks for registering a new account. Please click on the link below to confirm your email address and finish the registration process\\n' + confirmEmailLink\n  // send email here\n  var mailOptions = {\n    from: \"Fred Foo ✔ <info@example.com>\", // sender address\n    to: email, // list of receivers\n    subject: \"Hello ✔\", // Subject line\n    text: emailBody, // plaintext body\n    html: \"<b>Hello world ✔</b>\" // html body\n  }\n\n  // send mail with defined transport object\n  smtpTransport.sendMail(mailOptions, function(err, response){\n    var outputError\n    if (err) {\n      outputError = new restify.InternalError('register completed correctly but failed to send')\n      outputError.body.error = err\n      outputError.body.reason = 'send_email_failed'\n      res.send(outputError)\n      return\n    }\n    // never send the confirmToken directly to the user\n    delete user.confirmToken\n    res.send(user)\n  })\n}\n\n/**\n * generatePasswordResetTokenCallback\n * @param  {Stream} req  the incoming request from the client\n * @param  {Stream} res  the response stream used to send data  back to the client\n * @param  {Object} user the user data provided by the backend after the registration process is complete.\n *  the user ojbect contains the fields\n *   {\n *      email: \"foo@example.com\",\n *      _id: 'id of user in backend data-store',\n *     confirmToken: 'the token to email to the user so that they can confirm your account\n *   }\n */\nvar generatePasswordResetTokenCallback = function(req, res, user) {\n  var email = user.email\n  var resetToken = user.resetToken\n  // email the confirm token to the user now\n  var resetLink = 'http://localhost:3000/resetPassword?resetToken=' + resetToken\n  var emailBody = 'You have requested to reset your password. Please click on the link below to reset your password\\n' + resetLink\n  // send email here\n  var mailOptions = {\n    from: 'Fred Foo <info@example.com>', // sender address\n    to: email, // list of receivers\n    subject: 'Hello', // Subject line\n    text: emailBody, // plaintext body\n    html: '<b>Hello world</b>' // html body\n  }\n\n  // send mail with defined transport object\n  smtpTransport.sendMail(mailOptions, function(err, response){\n    var outputError\n    if (err) {\n      outputError = new restify.InternalError('generatePasswordResetToken completed correctly but failed to send email to user with reset link')\n      outputError.body.error = err\n      outputError.body.reason = 'send_email_failed'\n      res.send(outputError)\n      return\n    }\n\n    // never send the resetToken directly to the user\n    delete user.resetToken\n    res.send(user)\n  })\n}\n\n// pass the backend in as a parameter. Note that server here is an instance of restify.createServer\nvar server = userificServer(backend, serverConfig, registerCallback, generatePasswordResetTokenCallback)\n// start the server on port 3000\nvar port = 3000\nserver.listen(3000)\n\n```\n\n\nWhen creating the server in the example above, `serverConfig` is the configuration object that is passed to `restify.createServer`. [Restify Documentation](http://mcavage.github.io/node-restify/#Creating-a-Server). For example if you wish to create an https server, pass the certificate and key objects\n\n```javascript\nvar userificServer = require('userific-server')\nvar backend = {} //some instatiated userific backend\nvar serverConfig = {\n    certificate: 'PEM-encoded certificate string here',\n    key: 'PEM-encoded key string here'\n}\n\nvar server = userificServer(backend, serverConfig)\n```\n\n\n# Routes\nFor 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.\n\n* `https://localhost:3000/register`\n* `https://localhost:3000/confirmEmail`\n* `https://localhost:3000/authenticate`\n* `https://localhost:3000/changeEmail`\n* `https://localhost:3000/changePassword`\n* `https://localhost:3000/generatePasswordResetToken`\n* `https://localhost:3000/resetPassword`\n\nFor more information on the server api, consult the [apiary.io documentation here](http://docs.userificserver.apiary.io/)\n\n# Example\n\nAn example of how you might create your own userific server is included. Open the `./examples/` folder for more information\n\n","_id":"userific-server@0.1.3","dist":{"shasum":"13460de9122670dab17f510a74fd408b42bee05b","tarball":"https://registry.npmjs.org/userific-server/-/userific-server-0.1.3.tgz","integrity":"sha512-H/lt9oW2hi2uylr66VusfSV9v0XPi7SD30F2v9vLOcAxcy+rYHcN8XV/uV05/I9KuQRWWB2pSOMqElSKL2qRpw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGhTQIzcCxBk6JMHG7toep3VQAYwQkihM1Y1wrqk4wNLAiEAxEvrFnzMDODGwPI3W3MUi09TdrBV41Z404vPImhKb0I="}]},"_from":".","_npmVersion":"1.2.32","_npmUser":{"name":"clewfirst","email":"noah@nisaacson.com"},"maintainers":[{"name":"clewfirst","email":"noah@nisaacson.com"}]},"0.1.4":{"name":"userific-server","version":"0.1.4","description":"A restful api server to manage users in your application. The server can be used with any userfic backends.","main":"index.js","directories":{"test":"test"},"scripts":{"test":"make test"},"repository":{"type":"git","url":"git://github.com/nisaacson/userific-server.git"},"keywords":["userific","user","registeration","backend","api","rest","restify"],"author":{"name":"Noah Isaacson"},"license":"BSD","readmeFilename":"README.md","dependencies":{"restify":"~2.6.0","restify-validator":"~0.3.1","should":"~1.2.2","userific-postgres":"~0.1.10","async":"~0.2.9"},"devDependencies":{"eyespect":"~0.1.10","should":"~1.2.2","mocha":"~1.11.0","request":"~2.21.0","clone-extend":"~0.1.2","cloneextend":"0.0.3","userific-mongoose":"0.0.7","mongoose":"~3.6.11","nconf":"~0.6.7","userific-test":"0.0.12","userific-postgres":"~0.1.1","optimist":"~0.5.2","uuid":"~1.4.1"},"gitHead":"7a3b9dcb806745102c64e736c2b2149191078f79","bugs":{"url":"https://github.com/nisaacson/userific-server/issues"},"readme":"# Userfic Server\n[![Build Status](https://travis-ci.org/nisaacson/userific-server.png)](https://travis-ci.org/nisaacson/userific-server)\n\nA restful api server to manage users in your application. The server can be used with any userfic backends.\n\n# Installation\n\n```bash\nnpm install -S userific-server\n```\n\n# Setup\nTo setup the server you need to supply a properly configured userific backend. When creating the server you need to supply your own callbacks to the `register` and `generatePasswordResetToken`. Both of these functions generate secret tokens which are used to confirm the user by their email address. The userific api server is intended to be a public-facing api so the tokens cannot be passed back directly to the user. Each callback will be passed the `req` (request),`res` (response) and the data provided by the backend after the work is complete\n\n```javascript\nvar restify = require('restify')\nvar nodemailer = require(\"nodemailer\");\nvar smtpTransport = nodemailer.createTransport(\"SMTP\",{\n    service: \"Gmail\",\n    auth: {\n        user: \"gmail.user@gmail.com\",\n        pass: \"userpass\"\n    }\n});\nvar userificServer = require('userific-server')\nvar mongooseBackend = require('userific-mongoose')\nvar config = {\n    database: 'fooDatabase',\n    username: 'fooUsername',\n    password: 'fooPassword'\n}\n\n// instatiate a mongoose userific backend which stores user data in a MongoDB database\nvar backend = mongooseBackend(config)\n\n\n/**\n * registerCallback\n * @param  {Stream} req  the incoming request from the client\n * @param  {Stream} res  the response stream used to send data  back to the client\n * @param  {Object} user the user data provided by the backend after the registration process is complete.\n *  the user ojbect contains the fields\n *   {\n *      email: \"foo@example.com\",\n *      _id: 'id of user in backend data-store',\n *     confirmToken: 'the token to email to the user so that they can confirm your account\n *   }\n */\nvar registerCallback = function(req, res, user) {\n  var email = user.email\n  var confirmToken = user.confirmToken\n  // email the confirm token to the user now\n  var confirmEmailLink = 'http://localhost:3000/confirmEmail?confirmToken=' + confirmToken\n  var emailBody = 'Thanks for registering a new account. Please click on the link below to confirm your email address and finish the registration process\\n' + confirmEmailLink\n  // send email here\n  var mailOptions = {\n    from: \"Fred Foo ✔ <info@example.com>\", // sender address\n    to: email, // list of receivers\n    subject: \"Hello ✔\", // Subject line\n    text: emailBody, // plaintext body\n    html: \"<b>Hello world ✔</b>\" // html body\n  }\n\n  // send mail with defined transport object\n  smtpTransport.sendMail(mailOptions, function(err, response){\n    var outputError\n    if (err) {\n      outputError = new restify.InternalError('register completed correctly but failed to send')\n      outputError.body.error = err\n      outputError.body.reason = 'send_email_failed'\n      res.send(outputError)\n      return\n    }\n    // never send the confirmToken directly to the user\n    delete user.confirmToken\n    res.send(user)\n  })\n}\n\n/**\n * generatePasswordResetTokenCallback\n * @param  {Stream} req  the incoming request from the client\n * @param  {Stream} res  the response stream used to send data  back to the client\n * @param  {Object} user the user data provided by the backend after the registration process is complete.\n *  the user ojbect contains the fields\n *   {\n *      email: \"foo@example.com\",\n *      _id: 'id of user in backend data-store',\n *     confirmToken: 'the token to email to the user so that they can confirm your account\n *   }\n */\nvar generatePasswordResetTokenCallback = function(req, res, user) {\n  var email = user.email\n  var resetToken = user.resetToken\n  // email the confirm token to the user now\n  var resetLink = 'http://localhost:3000/resetPassword?resetToken=' + resetToken\n  var emailBody = 'You have requested to reset your password. Please click on the link below to reset your password\\n' + resetLink\n  // send email here\n  var mailOptions = {\n    from: 'Fred Foo <info@example.com>', // sender address\n    to: email, // list of receivers\n    subject: 'Hello', // Subject line\n    text: emailBody, // plaintext body\n    html: '<b>Hello world</b>' // html body\n  }\n\n  // send mail with defined transport object\n  smtpTransport.sendMail(mailOptions, function(err, response){\n    var outputError\n    if (err) {\n      outputError = new restify.InternalError('generatePasswordResetToken completed correctly but failed to send email to user with reset link')\n      outputError.body.error = err\n      outputError.body.reason = 'send_email_failed'\n      res.send(outputError)\n      return\n    }\n\n    // never send the resetToken directly to the user\n    delete user.resetToken\n    res.send(user)\n  })\n}\n\n// pass the backend in as a parameter. Note that server here is an instance of restify.createServer\nvar server = userificServer(backend, serverConfig, registerCallback, generatePasswordResetTokenCallback)\n// start the server on port 3000\nvar port = 3000\nserver.listen(3000)\n\n```\n\n\nWhen creating the server in the example above, `serverConfig` is the configuration object that is passed to `restify.createServer`. [Restify Documentation](http://mcavage.github.io/node-restify/#Creating-a-Server). For example if you wish to create an https server, pass the certificate and key objects\n\n```javascript\nvar userificServer = require('userific-server')\nvar backend = {} //some instatiated userific backend\nvar serverConfig = {\n    certificate: 'PEM-encoded certificate string here',\n    key: 'PEM-encoded key string here'\n}\n\nvar server = userificServer(backend, serverConfig)\n```\n\n\n# Routes\nFor 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.\n\n* `https://localhost:3000/register`\n* `https://localhost:3000/confirmEmail`\n* `https://localhost:3000/authenticate`\n* `https://localhost:3000/changeEmail`\n* `https://localhost:3000/changePassword`\n* `https://localhost:3000/generatePasswordResetToken`\n* `https://localhost:3000/resetPassword`\n\nFor more information on the server api, consult the [apiary.io documentation here](http://docs.userificserver.apiary.io/)\n\n# Example\n\nAn example of how you might create your own userific server is included. Open the `./examples/` folder for more information\n\n","_id":"userific-server@0.1.4","dist":{"shasum":"bdeb47daf5d295ba5f08a91738e3a4d608f7a0fa","tarball":"https://registry.npmjs.org/userific-server/-/userific-server-0.1.4.tgz","integrity":"sha512-ZjjwdEdXRMIR59yYgHGX27jhAKgTLfd28eqnIFlf/mhzTpw0kM2qM8EJspYA2LOEOCzOJvPCdBd7RsxiS3dJlw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIC6wCda3AFzubn7n0nv4opQ+uhK+R79OAvYnfUcFsg4yAiBuaVHs6KbhtkzfTosuwR03KxV4vfngogm0Gb3NLcs+nA=="}]},"_from":".","_npmVersion":"1.3.1","_npmUser":{"name":"clewfirst","email":"noah@nisaacson.com"},"maintainers":[{"name":"clewfirst","email":"noah@nisaacson.com"}]},"0.1.5":{"name":"userific-server","version":"0.1.5","description":"A restful api server to manage users in your application. The server can be used with any userfic backends.","main":"index.js","directories":{"test":"test"},"scripts":{"test":"make test"},"repository":{"type":"git","url":"git://github.com/nisaacson/userific-server.git"},"keywords":["userific","user","registeration","backend","api","rest","restify"],"author":{"name":"Noah Isaacson"},"license":"BSD","readmeFilename":"README.md","dependencies":{"restify":"~2.6.0","restify-validator":"~0.3.1","should":"~1.2.2","userific-postgres":"~0.1.11","async":"~0.2.9","userific-server":"~0.1.4"},"devDependencies":{"eyespect":"~0.1.10","should":"~1.2.2","mocha":"~1.11.0","request":"~2.21.0","clone-extend":"~0.1.2","cloneextend":"0.0.3","userific-mongoose":"0.0.7","mongoose":"~3.6.11","nconf":"~0.6.7","userific-test":"0.0.12","userific-postgres":"~0.1.1","optimist":"~0.5.2","uuid":"~1.4.1"},"gitHead":"7a3b9dcb806745102c64e736c2b2149191078f79","bugs":{"url":"https://github.com/nisaacson/userific-server/issues"},"readme":"# Userfic Server\n[![Build Status](https://travis-ci.org/nisaacson/userific-server.png)](https://travis-ci.org/nisaacson/userific-server)\n\nA restful api server to manage users in your application. The server can be used with any userfic backends.\n\n# Installation\n\n```bash\nnpm install -S userific-server\n```\n\n# Setup\nTo setup the server you need to supply a properly configured userific backend. When creating the server you need to supply your own callbacks to the `register` and `generatePasswordResetToken`. Both of these functions generate secret tokens which are used to confirm the user by their email address. The userific api server is intended to be a public-facing api so the tokens cannot be passed back directly to the user. Each callback will be passed the `req` (request),`res` (response) and the data provided by the backend after the work is complete\n\n```javascript\nvar restify = require('restify')\nvar nodemailer = require(\"nodemailer\");\nvar smtpTransport = nodemailer.createTransport(\"SMTP\",{\n    service: \"Gmail\",\n    auth: {\n        user: \"gmail.user@gmail.com\",\n        pass: \"userpass\"\n    }\n});\nvar userificServer = require('userific-server')\nvar mongooseBackend = require('userific-mongoose')\nvar config = {\n    database: 'fooDatabase',\n    username: 'fooUsername',\n    password: 'fooPassword'\n}\n\n// instatiate a mongoose userific backend which stores user data in a MongoDB database\nvar backend = mongooseBackend(config)\n\n\n/**\n * registerCallback\n * @param  {Stream} req  the incoming request from the client\n * @param  {Stream} res  the response stream used to send data  back to the client\n * @param  {Object} user the user data provided by the backend after the registration process is complete.\n *  the user ojbect contains the fields\n *   {\n *      email: \"foo@example.com\",\n *      _id: 'id of user in backend data-store',\n *     confirmToken: 'the token to email to the user so that they can confirm your account\n *   }\n */\nvar registerCallback = function(req, res, user) {\n  var email = user.email\n  var confirmToken = user.confirmToken\n  // email the confirm token to the user now\n  var confirmEmailLink = 'http://localhost:3000/confirmEmail?confirmToken=' + confirmToken\n  var emailBody = 'Thanks for registering a new account. Please click on the link below to confirm your email address and finish the registration process\\n' + confirmEmailLink\n  // send email here\n  var mailOptions = {\n    from: \"Fred Foo ✔ <info@example.com>\", // sender address\n    to: email, // list of receivers\n    subject: \"Hello ✔\", // Subject line\n    text: emailBody, // plaintext body\n    html: \"<b>Hello world ✔</b>\" // html body\n  }\n\n  // send mail with defined transport object\n  smtpTransport.sendMail(mailOptions, function(err, response){\n    var outputError\n    if (err) {\n      outputError = new restify.InternalError('register completed correctly but failed to send')\n      outputError.body.error = err\n      outputError.body.reason = 'send_email_failed'\n      res.send(outputError)\n      return\n    }\n    // never send the confirmToken directly to the user\n    delete user.confirmToken\n    res.send(user)\n  })\n}\n\n/**\n * generatePasswordResetTokenCallback\n * @param  {Stream} req  the incoming request from the client\n * @param  {Stream} res  the response stream used to send data  back to the client\n * @param  {Object} user the user data provided by the backend after the registration process is complete.\n *  the user ojbect contains the fields\n *   {\n *      email: \"foo@example.com\",\n *      _id: 'id of user in backend data-store',\n *     confirmToken: 'the token to email to the user so that they can confirm your account\n *   }\n */\nvar generatePasswordResetTokenCallback = function(req, res, user) {\n  var email = user.email\n  var resetToken = user.resetToken\n  // email the confirm token to the user now\n  var resetLink = 'http://localhost:3000/resetPassword?resetToken=' + resetToken\n  var emailBody = 'You have requested to reset your password. Please click on the link below to reset your password\\n' + resetLink\n  // send email here\n  var mailOptions = {\n    from: 'Fred Foo <info@example.com>', // sender address\n    to: email, // list of receivers\n    subject: 'Hello', // Subject line\n    text: emailBody, // plaintext body\n    html: '<b>Hello world</b>' // html body\n  }\n\n  // send mail with defined transport object\n  smtpTransport.sendMail(mailOptions, function(err, response){\n    var outputError\n    if (err) {\n      outputError = new restify.InternalError('generatePasswordResetToken completed correctly but failed to send email to user with reset link')\n      outputError.body.error = err\n      outputError.body.reason = 'send_email_failed'\n      res.send(outputError)\n      return\n    }\n\n    // never send the resetToken directly to the user\n    delete user.resetToken\n    res.send(user)\n  })\n}\n\n// pass the backend in as a parameter. Note that server here is an instance of restify.createServer\nvar server = userificServer(backend, serverConfig, registerCallback, generatePasswordResetTokenCallback)\n// start the server on port 3000\nvar port = 3000\nserver.listen(3000)\n\n```\n\n\nWhen creating the server in the example above, `serverConfig` is the configuration object that is passed to `restify.createServer`. [Restify Documentation](http://mcavage.github.io/node-restify/#Creating-a-Server). For example if you wish to create an https server, pass the certificate and key objects\n\n```javascript\nvar userificServer = require('userific-server')\nvar backend = {} //some instatiated userific backend\nvar serverConfig = {\n    certificate: 'PEM-encoded certificate string here',\n    key: 'PEM-encoded key string here'\n}\n\nvar server = userificServer(backend, serverConfig)\n```\n\n\n# Routes\nFor 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.\n\n* `https://localhost:3000/register`\n* `https://localhost:3000/confirmEmail`\n* `https://localhost:3000/authenticate`\n* `https://localhost:3000/changeEmail`\n* `https://localhost:3000/changePassword`\n* `https://localhost:3000/generatePasswordResetToken`\n* `https://localhost:3000/resetPassword`\n\nFor more information on the server api, consult the [apiary.io documentation here](http://docs.userificserver.apiary.io/)\n\n# Example\n\nAn example of how you might create your own userific server is included. Open the `./examples/` folder for more information\n\n","_id":"userific-server@0.1.5","dist":{"shasum":"fead3637e6da9a661304d31cd88344e96d3c9a1c","tarball":"https://registry.npmjs.org/userific-server/-/userific-server-0.1.5.tgz","integrity":"sha512-1ZCuqqENAqyCRigOUXdArjKQ1AJlQBy+P0Hn7z16hH3wXt4YCRYt+wwZGwydl6d23az7gsEQW7iImtsvtOoMgA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDUy9Xk30D/YSF3jjZyklBRRQ2iNsOTYYq/3m8K5clxjAIgbkkhj+6IDZGcyc51yGhDRSJ09VO50sCA60XC5tvO/Wc="}]},"_from":".","_npmVersion":"1.3.1","_npmUser":{"name":"clewfirst","email":"noah@nisaacson.com"},"maintainers":[{"name":"clewfirst","email":"noah@nisaacson.com"}]},"0.1.6":{"name":"userific-server","version":"0.1.6","description":"A restful api server to manage users in your application. The server can be used with any userfic backends.","main":"index.js","directories":{"test":"test"},"scripts":{"test":"make test"},"repository":{"type":"git","url":"git://github.com/nisaacson/userific-server.git"},"keywords":["userific","user","registeration","backend","api","rest","restify"],"author":{"name":"Noah Isaacson"},"license":"BSD","readmeFilename":"README.md","dependencies":{"restify":"~2.6.0","restify-validator":"~0.3.1","should":"~1.2.2","userific-postgres":"~0.1.13","async":"~0.2.9","userific-server":"~0.1.4","moment":"~2.1.0"},"devDependencies":{"eyespect":"~0.1.10","should":"~1.2.2","mocha":"~1.11.0","request":"~2.21.0","clone-extend":"~0.1.2","cloneextend":"0.0.3","userific-mongoose":"0.0.7","mongoose":"~3.6.11","nconf":"~0.6.7","userific-test":"0.0.12","userific-postgres":"~0.1.1","optimist":"~0.5.2","uuid":"~1.4.1"},"gitHead":"7a3b9dcb806745102c64e736c2b2149191078f79","bugs":{"url":"https://github.com/nisaacson/userific-server/issues"},"readme":"# Userfic Server\n[![Build Status](https://travis-ci.org/nisaacson/userific-server.png)](https://travis-ci.org/nisaacson/userific-server)\n\nA restful api server to manage users in your application. The server can be used with any userfic backends.\n\n# Installation\n\n```bash\nnpm install -S userific-server\n```\n\n# Setup\nTo setup the server you need to supply a properly configured userific backend. When creating the server you need to supply your own callbacks to the `register` and `generatePasswordResetToken`. Both of these functions generate secret tokens which are used to confirm the user by their email address. The userific api server is intended to be a public-facing api so the tokens cannot be passed back directly to the user. Each callback will be passed the `req` (request),`res` (response) and the data provided by the backend after the work is complete\n\n```javascript\nvar restify = require('restify')\nvar nodemailer = require(\"nodemailer\");\nvar smtpTransport = nodemailer.createTransport(\"SMTP\",{\n    service: \"Gmail\",\n    auth: {\n        user: \"gmail.user@gmail.com\",\n        pass: \"userpass\"\n    }\n});\nvar userificServer = require('userific-server')\nvar mongooseBackend = require('userific-mongoose')\nvar config = {\n    database: 'fooDatabase',\n    username: 'fooUsername',\n    password: 'fooPassword'\n}\n\n// instatiate a mongoose userific backend which stores user data in a MongoDB database\nvar backend = mongooseBackend(config)\n\n\n/**\n * registerCallback\n * @param  {Stream} req  the incoming request from the client\n * @param  {Stream} res  the response stream used to send data  back to the client\n * @param  {Object} user the user data provided by the backend after the registration process is complete.\n *  the user ojbect contains the fields\n *   {\n *      email: \"foo@example.com\",\n *      _id: 'id of user in backend data-store',\n *     confirmToken: 'the token to email to the user so that they can confirm your account\n *   }\n */\nvar registerCallback = function(req, res, user) {\n  var email = user.email\n  var confirmToken = user.confirmToken\n  // email the confirm token to the user now\n  var confirmEmailLink = 'http://localhost:3000/confirmEmail?confirmToken=' + confirmToken\n  var emailBody = 'Thanks for registering a new account. Please click on the link below to confirm your email address and finish the registration process\\n' + confirmEmailLink\n  // send email here\n  var mailOptions = {\n    from: \"Fred Foo ✔ <info@example.com>\", // sender address\n    to: email, // list of receivers\n    subject: \"Hello ✔\", // Subject line\n    text: emailBody, // plaintext body\n    html: \"<b>Hello world ✔</b>\" // html body\n  }\n\n  // send mail with defined transport object\n  smtpTransport.sendMail(mailOptions, function(err, response){\n    var outputError\n    if (err) {\n      outputError = new restify.InternalError('register completed correctly but failed to send')\n      outputError.body.error = err\n      outputError.body.reason = 'send_email_failed'\n      res.send(outputError)\n      return\n    }\n    // never send the confirmToken directly to the user\n    delete user.confirmToken\n    res.send(user)\n  })\n}\n\n/**\n * generatePasswordResetTokenCallback\n * @param  {Stream} req  the incoming request from the client\n * @param  {Stream} res  the response stream used to send data  back to the client\n * @param  {Object} user the user data provided by the backend after the registration process is complete.\n *  the user ojbect contains the fields\n *   {\n *      email: \"foo@example.com\",\n *      _id: 'id of user in backend data-store',\n *     confirmToken: 'the token to email to the user so that they can confirm your account\n *   }\n */\nvar generatePasswordResetTokenCallback = function(req, res, user) {\n  var email = user.email\n  var resetToken = user.resetToken\n  // email the confirm token to the user now\n  var resetLink = 'http://localhost:3000/resetPassword?resetToken=' + resetToken\n  var emailBody = 'You have requested to reset your password. Please click on the link below to reset your password\\n' + resetLink\n  // send email here\n  var mailOptions = {\n    from: 'Fred Foo <info@example.com>', // sender address\n    to: email, // list of receivers\n    subject: 'Hello', // Subject line\n    text: emailBody, // plaintext body\n    html: '<b>Hello world</b>' // html body\n  }\n\n  // send mail with defined transport object\n  smtpTransport.sendMail(mailOptions, function(err, response){\n    var outputError\n    if (err) {\n      outputError = new restify.InternalError('generatePasswordResetToken completed correctly but failed to send email to user with reset link')\n      outputError.body.error = err\n      outputError.body.reason = 'send_email_failed'\n      res.send(outputError)\n      return\n    }\n\n    // never send the resetToken directly to the user\n    delete user.resetToken\n    res.send(user)\n  })\n}\n\n// pass the backend in as a parameter. Note that server here is an instance of restify.createServer\nvar server = userificServer(backend, serverConfig, registerCallback, generatePasswordResetTokenCallback)\n// start the server on port 3000\nvar port = 3000\nserver.listen(3000)\n\n```\n\n\nWhen creating the server in the example above, `serverConfig` is the configuration object that is passed to `restify.createServer`. [Restify Documentation](http://mcavage.github.io/node-restify/#Creating-a-Server). For example if you wish to create an https server, pass the certificate and key objects\n\n```javascript\nvar userificServer = require('userific-server')\nvar backend = {} //some instatiated userific backend\nvar serverConfig = {\n    certificate: 'PEM-encoded certificate string here',\n    key: 'PEM-encoded key string here'\n}\n\nvar server = userificServer(backend, serverConfig)\n```\n\n\n# Routes\nFor 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.\n\n* `https://localhost:3000/register`\n* `https://localhost:3000/confirmEmail`\n* `https://localhost:3000/authenticate`\n* `https://localhost:3000/changeEmail`\n* `https://localhost:3000/changePassword`\n* `https://localhost:3000/generatePasswordResetToken`\n* `https://localhost:3000/resetPassword`\n\nFor more information on the server api, consult the [apiary.io documentation here](http://docs.userificserver.apiary.io/)\n\n# Example\n\nAn example of how you might create your own userific server is included. Open the `./examples/` folder for more information\n\n","_id":"userific-server@0.1.6","dist":{"shasum":"886308c2be45d38df5b7c9a7fcfc3e1929bda5c0","tarball":"https://registry.npmjs.org/userific-server/-/userific-server-0.1.6.tgz","integrity":"sha512-NVdP65OGyrK1jBovxa4XWJyK/yhMb4YnUG1CPKbzC6sfnGbT0tlZxIq47a9k839wIC0yxCVbckrtS5OhNoEIZQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIC/AwVnEQp0rmWVnE+zF1rT1WDJ9e58m0WF+27lKpVVjAiBsuTlAF8xhR7O2o+OvqYMiXJPVla9uiHhmz2mN/KBi/w=="}]},"_from":".","_npmVersion":"1.3.1","_npmUser":{"name":"clewfirst","email":"noah@nisaacson.com"},"maintainers":[{"name":"clewfirst","email":"noah@nisaacson.com"}]}},"readme":"# Userfic Server\nA restful api server to manage users in your application. The server can be used with any userfic backends.\n\n# Installation\n\n```bash\nnpm install -S userific-server\n```\n\n# Setup\nTo setup the server you need to supply a properly configured userific backend\n\n```javascript\nvar userificServer = require('userific-server')\nvar mongooseBackend = require('userific-mongoose')\nvar config = {\n    database: 'fooDatabase',\n    username: 'fooUsername',\n    password: 'fooPassword'\n}\n\n// instatiate a mongoose userific backend which stores user data in a MongoDB database\nvar backend = mongooseBackend(config)\n\n// pass the backend in as a parameter. Note that server here is an instance of restify.createServer\nvar server = userificServer(backend, serverConfig)\n// start the server on port 3000\nvar port = 3000\nserver.listen(3000)\n```\n\n\nWhen creating the server in the example above, `serverConfig` is the configuration object that is passed to `restify.createServer`. [Restify Documentation](http://mcavage.github.io/node-restify/#Creating-a-Server). For example if you wish to create an https server, pass the certificate and key objects\n\n```javascript\nvar userificServer = require('userific-server')\nvar backend = {} //some instatiated userific backend\nvar serverConfig = {\n    certificate: 'PEM-encoded certificate string here',\n    key: 'PEM-encoded key string here'\n}\n\nvar server = userificServer(backend, serverConfig)\n```\n\n\n# Routes\nFor 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.\n\n* `https://localhost:3000/register`\n* `https://localhost:3000/authenticate`\n* `https://localhost:3000/changeEmail`\n* `https://localhost:3000/changePassword`\n\n\n\n## Register\n\nTo register a new user\n","maintainers":[{"name":"clewfirst","email":"noah@nisaacson.com"}],"time":{"modified":"2022-06-28T06:53:34.889Z","created":"2013-06-16T18:35:45.754Z","0.0.1":"2013-06-16T18:35:46.527Z","0.0.2":"2013-06-16T20:53:10.530Z","0.0.3":"2013-06-18T23:16:25.714Z","0.0.4":"2013-06-19T17:05:06.713Z","0.0.5":"2013-06-21T23:10:31.832Z","0.1.0":"2013-06-21T23:29:59.505Z","0.1.1":"2013-06-22T00:07:18.223Z","0.1.2":"2013-06-22T00:39:48.183Z","0.1.3":"2013-06-30T23:31:20.795Z","0.1.4":"2013-07-09T19:03:11.509Z","0.1.5":"2013-07-09T19:12:27.319Z","0.1.6":"2013-07-09T19:54:31.769Z"},"author":{"name":"Noah Isaacson"},"repository":{"type":"git","url":"git://github.com/nisaacson/userific-server.git"}}