-
Notifications
You must be signed in to change notification settings - Fork 842
/
server.js
25 lines (20 loc) · 663 Bytes
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
"use strict";
const express = require("express");
const Unblocker = require("unblocker");
const app = express();
const unblocker = Unblocker({
// config options here...
});
app.use(unblocker);
app.get("/", (req, res) =>
res.redirect("/proxy/https://en.wikipedia.org/wiki/Main_Page")
);
// start the server and allow unblocker to proxy websockets:
const port = process.env.PORT || 8080;
app.listen(port).on("upgrade", unblocker.onUpgrade);
// or
// const http = require("http");
// const server = http.createServer(app);
// server.listen(port);
// server.on("upgrade", unblocker.onUpgrade);
console.log(`unblocker app live at http://localhost:${port}/`);