Set port to 80 and add hello-world
This commit is contained in:
parent
80ebab8fd9
commit
17eff4e739
1 changed files with 5 additions and 3 deletions
8
index.ts
8
index.ts
|
@ -1,9 +1,11 @@
|
||||||
|
console.log("Hello World!");
|
||||||
|
|
||||||
const fetch = (req: Request) => {
|
const fetch = (req: Request) => {
|
||||||
const url = new URL(req.url);
|
const url = new URL(req.url);
|
||||||
const path = url.pathname;
|
const path = url.pathname;
|
||||||
|
|
||||||
if (path === "/") {
|
if (path === "/") {
|
||||||
return new Response(Bun.file("./index.html"), {
|
return new Response(Bun.file("./index.html"), {
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "text/html"
|
"Content-Type": "text/html"
|
||||||
}
|
}
|
||||||
|
@ -39,7 +41,7 @@ const fetch = (req: Request) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
Bun.serve({
|
Bun.serve({
|
||||||
port: 8888,
|
port: 80,
|
||||||
hostname: "localhost",
|
hostname: "localhost",
|
||||||
fetch
|
fetch
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue