|
|
|
@ -15,6 +15,14 @@ const generateId = () => nanoid(32);
|
|
|
|
|
const clients: Record<string, http.ServerResponse> = {};
|
|
|
|
|
|
|
|
|
|
const server = http.createServer((req, res) => {
|
|
|
|
|
if (req.method === 'OPTIONS') {
|
|
|
|
|
res.writeHead(200, {
|
|
|
|
|
'Acess-Control-Allow-Methods': '*',
|
|
|
|
|
'Acess-Control-Allow-Headers': '*',
|
|
|
|
|
'Access-Control-Allow-Origin': process.env.ALLOW_ORIGIN || '*',
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
switch (req.url) {
|
|
|
|
|
case '/run':
|
|
|
|
|
const jobId = generateId();
|
|
|
|
|