forked from mrsproutt/Geode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
22 lines (18 loc) · 756 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import Easyviolet from 'easyviolet';
import express from 'express';
import path from 'node:path';
import url from 'node:url';
import fs from 'node:fs';
const app = express();
const ultraviolet = new Easyviolet({
codec: 'plain'
});
const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
app.use(express.static(path.join(__dirname, './static/'), { extensions: ['html'] }));
app.use((req, res) => {
if (!ultraviolet.requiresRoute(req)) res.send(fs.readFileSync(path.join(__dirname,'/static/assets/templates/404.html'))).status(404)
});
const server = app.listen(9000, () => {
console.log(`Your Geode proxy is up and running on port ${server.address().port}, using NodeJS version ${process.version}`);
});
ultraviolet.httpServer(server);