You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
HTTP Middleware done to parse query and path parameters from a given url, initially created to serve the [@lottojs/router](https://github.com/lottojs/router) package but nothing excludes it to be also used by the community.
35
+
36
+
A CORS middleware designed to enhance security by enabling secure cross-origin resource sharing in Node.js applications. Initially created to serve the [@lottojs/lotto](https://github.com/lottojs/lotto) package but nothing excludes it to be also used by the community.
37
+
36
38
37
39
## Documentation
38
40
Complete API documentation is available at [lottojs.tech][documentation-url].
@@ -41,19 +43,32 @@ Complete API documentation is available at [lottojs.tech][documentation-url].
41
43
42
44
### Installation
43
45
```sh
44
-
npm i @lottojs/params-parser
46
+
npm i @lottojs/cors
45
47
```
46
48
### Usage
47
-
It will depend on your scenario, basically the package exports a middleware called `paramsParser`. This middleware can be used receiving a path from any http handler and returns a promise awaiting to receive a request and next parameters. On the end it put's each parsed group on the right place, query parameters at `req.query` object and path parameters at `req.params` object, all ready to be used.
49
+
The package exports a middleware named `cors`. This middleware should be used within an HTTP server handler. It checks the request's origin and sets the appropriate CORS headers. This allows or restricts cross-origin requests based on the specified configuration.
0 commit comments