Expletive is a wrapper around express.js. It takes care of listening on a port or socket, sets up sessions, locales, file uploads and mustache as a view engine.
npm isntall --save expletive
var expletive = require("expletive");
var app = expletive({
root: "/path/to/root", // root directory, optional
secret: "cookie-secret", // a good secret for encrypting session-cookies
locales: { // avaliable locales, optional
"de": "Deutsch",
"en": "English"
},
csrf: true, // csrf protection, default: true
viewcache: false, // cache views, default: false
socket: "/path/to.sock", // listen on socket
host: "localhost", // listen on tcp
port: 3000, // listen on tcp
uploads: "./tmp", // upload directory
limit: "100kb" // upload size limit
});
// use `app` like you would use your express instance
app.get("/", function(req, res){
res.status("200").render("index", {
"hello": "world"
});
});
If no root
is specified, the folder where the main scriped lives is is used.
You must specify at least either a port
or a socket
. If port
is used, a hostname
may be specified as well.
If you don't provide an uploads
directory, uploads are disabled.
If you don't provide locales
, locales are disabled.