24 lines
546 B
JavaScript
24 lines
546 B
JavaScript
import express from "express";
|
|
import ViteExpress from "vite-express";
|
|
import { attachWebsocketServer } from "@vlcn.io/ws-server";
|
|
import * as http from "http";
|
|
|
|
const PORT = parseInt(process.env.PORT || "8080");
|
|
|
|
const app = express();
|
|
const server = http.createServer(app);
|
|
|
|
const wsConfig = {
|
|
dbFolder: "./dbs",
|
|
schemaFolder: "./src/schemas",
|
|
pathPattern: /\/sync/,
|
|
};
|
|
|
|
attachWebsocketServer(server, wsConfig);
|
|
|
|
server.listen(PORT, () =>
|
|
console.log("info", `listening on http://localhost:${PORT}!`)
|
|
);
|
|
|
|
ViteExpress.bind(app, server);
|