1.2.0 • Published 7 years ago
send-promised v1.2.0
send-promised
Handy promise wrapper for the send static file server.
Usage
send-promised
returns whether a request could be handled by static file serving, so you can
use it as the first part of your http handler function.
const send = require('send-promised')
const http = require('http')
const serve = (req, res) =>
send({
root: `${__dirname}/static` // and other options for `send`
})
http.createServer(async (req, res) => {
const served = await serve(req, res)
if (served) return
// handle other routes
})
Installation
$ npm install send-promised
License
MIT