48 lines
991 B
JavaScript
48 lines
991 B
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('/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()}`);
|
||
|
});
|