1.2.0 • Published 1 year ago

@rayo/send v1.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Install

$> npm i @rayo/send

Use

import rayo from 'rayo';
import send from '@rayo/send';

rayo({ port: 5050 })
  .through(send())
  .get('/hello/:user', (req, res) => {
    res.send({
      message: `Hello ${req.params.user}. I was sent with headers!`
    });
  })
  .start();

send will attach itself to the ServerResponse (a.k.a res) and be callable as res.send().

res.send() will try to guess the content-type based on the payload and send the appropriate headers. It will also send a status code and end the response.

Note: res.send() will incur a tiny performance hit due to the guess work and the headers being written with every response.

API

send()

Currently, it does not take any arguments.

License

MIT

1.2.0

1 year ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.2

2 years ago

1.1.0

3 years ago

1.0.23

3 years ago

1.0.19

4 years ago

1.0.21

4 years ago

1.0.20

4 years ago

1.0.17

5 years ago

1.0.16

5 years ago

1.0.15

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.5.0

7 years ago