-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
19 lines (19 loc) · 726 Bytes
/
server.js
File metadata and controls
19 lines (19 loc) · 726 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
const http = require('http'),
https = require('https'),
fs = require('fs'),
config = require('./config.json'),
Corrosion = require('corrosion'),
express = require('express'),
proxy = new Corrosion({
prefix: config.prefix,
codec: 'xor'
}),
app = express(),
gamermode = (req, res) => {
if (req.url.startsWith(config.prefix)) return proxy.request(req, res);
req.pathname = req.url.split('#')[0].split('?')[0];
req.query = {};};
app.use('/', express.static(__dirname + '/public'));
app.use('/', gamermode);
// Simple HTTP server.
app.listen(process.env.PORT || config.port, () => {console.log(`Lunar Proxy running at http://localhost:${config.port}`)});