abtmtr-comms/index.js
2024-10-06 02:20:01 -05:00

52 lines
No EOL
1 KiB
JavaScript

import express from "express";
import { config as dotenvConfig } from "dotenv";
import path from "path";
dotenvConfig();
const __dirname = import.meta.dirname;
const app = express();
app.set('trust proxy', true);
app.set('view engine', 'ejs');
app.use('/assets', express.static('assets'));
app.set('views', path.join(__dirname, "views", "pages"));
app.locals = {
__dirname
}
app.get('/', async (req, res) => {
res.render('index');
})
app.get('/whaticando', async (req, res) => {
res.render('whaticando');
})
app.get('/tos', async (req, res) => {
res.render('tos');
})
app.get('/pricing', async (req, res) => {
res.render('pricing');
})
app.get('/contact', async (req, res) => {
res.render('contact');
})
app.get("/favicon.ico", (req, res) => {
res.redirect("https://cdn.abtmtr.link/site_content/favicon.ico")
})
app.all('*', (req, res) => {
res.redirect("/");
})
app.listen(process.env.PORT, () => {
const url = new URL("http://localhost/");
url.port = process.env.PORT;
console.log(`Example app listening on ${url.toString()}`);
});