1.2.0 • Published 4 months ago

@rayo/send v1.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months 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

4 months ago

1.1.5

8 months ago

1.1.4

8 months ago

1.1.2

8 months ago

1.1.0

2 years ago

1.0.23

2 years ago

1.0.19

2 years ago

1.0.21

2 years ago

1.0.20

2 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.15

4 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.5.0

6 years ago