Skip to content

Commit e497118

Browse files
committed
Update generate.js
CORS
1 parent 4114e6d commit e497118

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

api/generate.js

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import { WordGenerator } from '../lib/WordGenerator.js';
22

33
export default function handler(req, res) {
4+
// Set CORS headers
5+
res.setHeader('Access-Control-Allow-Origin', '*');
6+
res.setHeader('Access-Control-Allow-Methods', 'GET');
7+
res.setHeader('Access-Control-Allow-Headers', 'Content-Type');
8+
49
const { wordList = 'latin', format = 'string', limit = 10 } = req.query;
510

611
// Initialize WordGenerator with the requested options

0 commit comments

Comments
 (0)