bestock-server
v1.0.2
Published
A basic wrapper around express, express-session, passport and jade.
Downloads
1
Readme
A basic server wrapper to make greenfield development faster. Mainly for personal use.
Usage
// Basic Server
var server = require("bestock-server")({
port: 8080
},
[
{
path: '/',
handler: function ( req, res, next ) {
res.status(200).end("Hello World!");
}
}
]
)();
// With Basic Authentication
var server = require("bestock-server")({
port: 8080,
auth: {
method: "local",
path: '/login', // path to POST credentials for login
onSuccess: '/', // redirect here after successful login
onFailure: '/login,
users: {
"username": {
password: "password",
data: { }
}
}
},
[
{
path: '/login',
handler: function ( req, res ) {
// Serve login page here
}
},
{
path: '/',
secure: true,
handler: function ( req, res ) {
// Do secure stuff here
// req.user == { id: "username", data: { } }
}
}
]
})();