start playing with websockets
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
// Import the framework and instantiate it
|
||||
import Fastify from 'fastify'
|
||||
import fastifyStatic from '@fastify/static'
|
||||
import {fastifyWebsocket} from '@fastify/websocket';
|
||||
import { routeList } from "./routelist.ts";
|
||||
import { route } from "./util/routewrap.ts";
|
||||
import { attachRoute } from "./util/routewrap.ts";
|
||||
import { git } from './util/git.ts';
|
||||
import path from "path";
|
||||
import {fileURLToPath} from 'url';
|
||||
@@ -17,13 +18,15 @@ const server = Fastify({
|
||||
logger: true
|
||||
});
|
||||
|
||||
server.register(fastifyWebsocket);
|
||||
|
||||
server.register(fastifyStatic, {
|
||||
root: new URL('public', import.meta.url).toString().slice("file://".length),
|
||||
prefix: '/',
|
||||
});
|
||||
|
||||
routeList.forEach(firRoute => {
|
||||
server.route(route(firRoute));
|
||||
attachRoute(server, firRoute);
|
||||
});
|
||||
|
||||
server.setNotFoundHandler((req, res) => {
|
||||
|
||||
Reference in New Issue
Block a user