https://github.com/candyframework/candy-deno-plugin-cors
Cors plgin for @candy/framework
https://github.com/candyframework/candy-deno-plugin-cors
Last synced: over 1 year ago
JSON representation
Cors plgin for @candy/framework
- Host: GitHub
- URL: https://github.com/candyframework/candy-deno-plugin-cors
- Owner: candyframework
- Created: 2025-01-23T11:11:32.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-23T11:17:07.000Z (over 1 year ago)
- Last Synced: 2025-01-23T12:23:06.997Z (over 1 year ago)
- Language: TypeScript
- Size: 1000 Bytes
- Stars: 0
- Watchers: 6
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Cors plgin for @candy/framework
## Simple Usage
```typescript
import Hook from '@candy/framework/core/Hook.ts';
import Cors from '@candy/plugin-cors';
Hook.use(Cors());
Hook.use(async (_req: Request, hook: Hook) => {
console.log('hook2 run');
return await hook.next();
});
```
## Configuring CORS
```typescript
Hook.use(Cors({
// origins: ['*'],
origins: ['https://www.mydomain.com'],
allowMethods: ['GET', 'POST'],
allowHeaders: [],
allowCredentials: false,
maxAge: '86400',
exposeHeaders: [],
}));
```