examples/mac/app.js
function createServer () {

    // Create server

    var server = express.createServer();

    // Configure Server

    server.configure(function () {

        // Built-in

        server.use(express.methodOverride());                           // Allow method override using _method form parameter
        server.use(express.bodyDecoder()); 	                            // Parse application/x-www-form-urlencoded
        server.use(express.staticProvider(__dirname + '/files'));       // Serve client documents in local directory

        // Local

        server.use(setResponseHeader());                                // Set default response headers for CORS
        server.use(logConsole());                                       // Display incoming requests

        // Authentication

        server.use(auth([auth.Mac({ realm: "Example",                   // Set realm, typically a domain name or application name
                                    getTokenAttributes: getToken,       // Function used to fetch the access token record, typically from a database
                                    // hostHeader: 'x-forwarded-host',  // Needed when running behind a proxy such as Apache2
                                    // isHTTPS: true,                   // Uncomment for HTTPS
                                    checkNonce: nonceCheck,             // Optional nonce checking function
                                    bodyHashMode: "require" })]));      // Require body hash validation for all non GET/HEAD/OPTIONS requests
    });

    // Setup generic OPTIONS route

    server.options(/.+/, function (req, res) {

        res.send(' ');
    });

    return server;
}
function createServer () {

    // Create server

    var server = express.createServer();

    // Configure Server

    server.configure(function () {

        // Built-in

        server.use(express.methodOverride());                           // Allow method override using _method form parameter
        server.use(express.bodyDecoder()); 	                            // Parse application/x-www-form-urlencoded
        server.use(express.staticProvider(__dirname + '/files'));       // Serve client documents in local directory

        // Local

        server.use(setResponseHeader());                                // Set default response headers for CORS
        server.use(logConsole());                                       // Display incoming requests

        // Authentication

        server.use(auth([auth.Mac({ realm: "Example",                   // Set realm, typically a domain name or application name
                                    getTokenAttributes: getToken,       // Function used to fetch the access token record, typically from a database
                                    // hostHeader: 'x-forwarded-host',  // Needed when running behind a proxy such as Apache2
                                    // isHTTPS: true,                   // Uncomment for HTTPS
                                    checkNonce: nonceCheck,             // Optional nonce checking function
                                    bodyHashMode: "require" })]));      // Require body hash validation for all non GET/HEAD/OPTIONS requests
    });

    // Setup generic OPTIONS route

    server.options(/.+/, function (req, res) {

        res.send(' ');
    });

    return server;
}
function createServer ( ) { // Create server var server = express . createServer ( ) ; // Configure Server server . configure ( function ( ) { // Built-in server . use ( express . methodOverride ( ) ) ; // Allow method override using _method form parameter server . use ( express . bodyDecoder ( ) ) ; // Parse application/x-www-form-urlencoded server . use ( express . staticProvider ( __dirname + '/files' ) ) ; // Serve client documents in local directory // Local server . use ( setResponseHeader ( ) ) ; // Set default response headers for CORS server . use ( logConsole ( ) ) ; // Display incoming requests // Authentication server . use ( auth ( [ auth . Mac ( { realm : "Example" , // Set realm, typically a domain name or application name getTokenAttributes : getToken , // Function used to fetch the access token record, typically from a database // hostHeader: 'x-forwarded-host',  // Needed when running behind a proxy such as Apache2 // isHTTPS: true,                   // Uncomment for HTTPS checkNonce : nonceCheck , // Optional nonce checking function bodyHashMode : "require" } ) ] ) ) ; // Require body hash validation for all non GET/HEAD/OPTIONS requests } ) ; // Setup generic OPTIONS route server . options ( / .+ / , function ( req , res ) { res . send ( ' ' ) ; } ) ; return server ; }
Create and configure server instance
Create and configure server instance