-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
33 lines (30 loc) · 702 Bytes
/
index.js
File metadata and controls
33 lines (30 loc) · 702 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
26
27
28
29
30
31
32
33
import express from "express";
const app = express();
import request from "request";
import http from "http";
import { expressMiddlewareProxy } from "./express-middleware.js";
app.all("/", (req, res) => {
return res.json({
message: "Hello World",
});
});
app.post(
"/echo",
expressMiddlewareProxy({
path: "/echo",
})
);
app.get(
"/temp",
expressMiddlewareProxy({
path: "/temp",
})
);
app.get("/wait", expressMiddlewareProxy({}));
app.get("/file", (req, res) => {
console.log(import.meta.url.slice(7, -8) + "user.json");
return res.sendFile(import.meta.url.slice(7, -8) + "user.json");
});
app.listen(3000, (err) => {
console.log("Server running on port 3000");
});