-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
25 lines (19 loc) · 733 Bytes
/
Copy pathserver.js
File metadata and controls
25 lines (19 loc) · 733 Bytes
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
import app from "./api/index.js";
import express from "express";
import path from "path";
import { fileURLToPath } from "url";
// This file is purely for local development (npm run dev).
// Vercel handles static routing directly via vercel.json.
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
app.use(express.static("public"));
app.get("/v/:id", (req, res) => {
res.sendFile(path.join(__dirname, "public", "view.html"));
});
app.get("/create", (req, res) => {
res.sendFile(path.join(__dirname, "public", "create.html"));
});
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
console.log(`Local development server is running on http://localhost:${PORT}`);
});