https://github.com/httpland/cors
CORS protocol utility for standard Request and Response
https://github.com/httpland/cors
cors http preflight request response utility
Last synced: about 1 month ago
JSON representation
CORS protocol utility for standard Request and Response
- Host: GitHub
- URL: https://github.com/httpland/cors
- Owner: httpland
- License: mit
- Created: 2022-08-09T10:46:08.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-02-14T07:03:13.000Z (about 3 years ago)
- Last Synced: 2025-11-07T16:00:30.640Z (5 months ago)
- Topics: cors, http, preflight, request, response, utility
- Homepage: https://deno.land/x/cors_protocol
- Size: 73.2 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
# cors
CORS protocol for standard `Request` and `Response`.
## Usage
core:
- `withCors` - Create a handler that supports the CORS protocol.
basic:
```ts
import { withCors } from "https://deno.land/x/cors_protocol@$VERSION/mod.ts";
import { Handler, serve } from "https://deno.land/std@$VERSION/http/mod.ts";
function handler(req: Request): Response {
return new Response("Hello");
}
await serve(withCors(handler));
```
then, The endpoint support simple request and preflight request.
## License
Copyright © 2022-present [httpland](https://github.com/httpland).
Released under the [MIT](./LICENSE) license