Skip to content
Open

Hi #11

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions index.js

This file was deleted.

76 changes: 0 additions & 76 deletions main/index.html

This file was deleted.

22 changes: 22 additions & 0 deletions public/Index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import express from 'express';
import { createServer } from 'node:http';
import { join } from 'path';
import { fileURLToPath } from 'url';
import { dirname } from 'path';

const app = express();
const server = createServer(app);

// Serve files in public/
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
app.use(express.static(join(__dirname, 'public')));

// Fallback to index.html
app.get('*', (req, res) => {
res.sendFile(join(__dirname, 'public', 'index.html'));
});

server.listen(process.env.PORT || 3000, () => {
console.log('Server running...');
});
12 changes: 12 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Utopia Unblocker</title>
</head>
<body>
<h1>Welcome to Utopia Unblocker</h1>
<p>Your proxy is up and running!</p>
</body>
</html>
15 changes: 6 additions & 9 deletions vercel.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
{
"version": 2,
"builds": [{
"src": "index.js",
"use": "@vercel/node"
}],
"routes": [{
"src": "/(.*)",
"dest": "index.js"
}]
"builds": [
{ "src": "index.js", "use": "@vercel/node" }
],
"routes": [
{ "src": "/(.*)", "dest": "/index.js" }
]
}