INNER CODE UNIT · TypeScript

createApp

pranshuchittora/simvyn · packages/server/src/app.ts:86

export async function createApp(opts: AppOptions = {}): Promise<FastifyInstance> {
	const { modulesDir, modules, dashboardDir, logger = true, version = "0.0.0" } = opts;

	const fastify = Fastify({ logger });

	await fastify.register(fastifyWebsocket);

	if (dashboardDir) {
		await fastify.register(fastifyStatic, {
			root: dashboardDir,
			wildcard: false,
		});

		fastify.setNotFoundHandler((req, reply) => {
			if (req.url.startsWith("/api/")) {
				return reply.status(404).send({
					statusCode: 404,
					error: "Not Found",

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…