How to use the derby.createStatic function in derby

To help you get started, we’ve selected a few derby examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lefnire / derby-auth / example / lib / server / serverError.js View on Github external
module.exports = function() {
    var staticPages = derby.createStatic(path.dirname(path.dirname(__dirname)))

    return function(err, req, res, next) {
        if (err == null) return next()

        console.log(err.stack ? err.stack : err)

        // Customize error handling here
        var message = err.message || err.toString()
        var status = parseInt(message)
        status = (status >= 400 && status < 600) ? status : 500

        if (status === 403 || status === 404 || status === 500) {
            staticPages.render('error', res, status.toString(), status)
        } else {
            res.send(status)
        }

derby

MVC framework making it easy to write realtime, collaborative applications that run in both Node.js and browsers.

MIT
Latest version published 4 days ago

Package Health Score

73 / 100
Full package analysis