1.2.0 • Published 7 years ago

send-promised v1.2.0

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

send-promised

development sponsored by voltra.co

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

1.2.0

7 years ago

1.1.0

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago