Bun Write a simple HTTP server

Write a simple HTTP server

jarle Updated

File contents

Write a simple HTTP server

This starts an HTTP server listening on port 3000. It responds to all requests with a Response with status 200 and body "Welcome to Bun!".

See Bun.serve for details.

const server = Bun.serve({
  port: 3000,
  fetch(request) {
    return new Response("Welcome to Bun!");
  },
});

console.log(`Listening on ${server.url}`);

jarle/bun-skills/tree/main/skills/bun-guides-http-simple commit caabedcd6c

Frequently asked questions

npx skillmds@latest add jarle/bun-write-a-simple-http-server