fp/services/actor/src/server.ts
CJ_Clippy cc0f0a33fa
Some checks failed
rssapp CI/CD / build (push) Successful in 2m2s
ci / test (push) Failing after 1m5s
ci / build (push) Has been cancelled
add rssapp gitea actions builder
2025-09-28 00:55:50 -08:00

22 lines
599 B
TypeScript

import Fastify from 'fastify';
import { env } from './env.js';
import { createVultrInstance } from './vultr.js';
const fastify = Fastify();
fastify.post('/webhook', async (request, reply) => {
try {
const instance = await createVultrInstance();
console.log('Created instance:', instance);
return { status: 'ok', instance };
} catch (err: any) {
console.error(err);
reply.status(500).send({ status: 'error', message: err.message });
}
});
fastify.listen({ port: env.WEBHOOK_PORT }, (err, addr) => {
if (err) throw err;
console.log(`Server listening at ${addr}`);
});