mast/mast-react/server.js
Anish Lakhwara f7b2d09c4b init react
2024-10-26 00:00:30 -07:00

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);