mcavage/node-restify — pull request #719 by Wavewash (2014-12-07 06:36:25+00:00)
Title: Update static.js

When using restify moving from express, I found sending a static file of which I knew the direct path to difficult when I was trying to map a route to it which did not contain the filename in it.

For example in express:

app.get('/cool', function (req, res) {
res.sendFile("../public/coolindex.html");
}

the proposed change:
By sending a "file" option now with the serveStatic call you can serve a file which does not have its' filename present in the req.path there by mapping routes to static files.

Example usage:
app.get('/logins',
restify.serveStatic({
directory: './public',
file: 'login.html'
})
);