As you know, Bun is the fastest JavaScript runtime and the substitute for Node.js.
Today, I want to introduce the first step of Bun.
Install Bun globally
# Open your terminal
$ curl -fsSL https://bun.sh/install | bash
Create a TypeScript file
# In your terminal
$ touch index.tsx
// index.tsx
const server = Bun.serve({
port: 3000,
fetch(request) {
return new Response("Welcome to Bun!");
},
});
console.log(`Listening on localhost:${server.port}`);
Lounch a server with Bun
# In your terminal
$ bun run index.tsx
Welcome to Bun!!!
Top comments (0)