AutoCallManu/web.js

31 lines
853 B
JavaScript
Raw Normal View History

import express from "express";
import session from "express-session";
import { deployHandler } from "./utils/handler.js";
import favicon from "serve-favicon";
2023-12-06 08:46:58 +01:00
async function launchWeb() {
2023-12-06 08:46:58 +01:00
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,
}),
);
2023-12-06 08:46:58 +01:00
app.use("/assets", express.static(`${process.env.WWW}/assets`));
app.use(favicon(`${process.env.WWW}/assets/images/favicon.ico`));
2023-12-06 08:46:58 +01:00
await deployHandler(app);
2023-12-06 08:46:58 +01:00
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
console.log(`App available at http://localhost:${PORT}`);
});
}
export { launchWeb };