AutoCallManu/web.js

31 lines
853 B
JavaScript

import express from "express";
import session from "express-session";
import { deployHandler } from "./utils/handler.js";
import favicon from "serve-favicon";
async function launchWeb() {
const app = express();
app.use(express.json()); // Used to parse JSON bodies
app.use(express.urlencoded({ extended: false })); //Parse URL-encoded bodies
app.use(
session({
secret: process.env.SECRET,
resave: false,
saveUninitialized: true,
}),
);
app.use("/assets", express.static(`${process.env.WWW}/assets`));
app.use(favicon(`${process.env.WWW}/assets/images/favicon.ico`));
await deployHandler(app);
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
console.log(`App available at http://localhost:${PORT}`);
});
}
export { launchWeb };