What is Bun?

JavaScript development is on the fast track to becoming faster than a caffeinated squirrel! For ages, Node.js has been the heavyweight champ of backend JavaScript for ages, but guess who's crashing the party? It's Bun, and it's here to give Node.js a swift kick in the virtual pants.

Node.js, don't fret, you're still cool, but it's time for a changing of the JavaScript guard! Bun is shaking things up. I mean, we're talking an all-in-one Swiss army knife for JavaScript apps that runs faster than a cheetah on roller skates and uses memory like it's on a diet!

Bun's not just stirring the pot, it's flipping it, spicing things up, and making Node.js do a double take. It's like the Usain Bolt of JavaScript, leaving its competition gobsmacked with its 4x speed boost and memory-saving magic trick! Say hello to the future, because Bun's here to shake things up!

ORIGIN OF BUN

Bun came to life thanks to the brainpower of Jarred Sumner, making its grand entrance on September 8th, 2023. Big shoutout to you, Jarred!

Bun was built in Zig, a general-purpose programming language for building reusable software applications. Think of it as Zig saying, 'I'm like C++, but with a top hat and a monocle!'"

HOW TO INSTALL BUN

  1. npm

    `npm install -g bun`

  2. Linux

     curl -fsSL https://bun.sh/install | bash # for macOS, Linux, and WSL
     # to install a specific version
     curl -fsSL https://bun.sh/install | bash -s "bun-v1.0.0"
    
  3. Windows

    Unfortunately, though, Bun does not directly install on Windows like it does with Linux. However, it can be done with the help of Windows Linux Subsystem.

    Read more here https://blog.bitsrc.io/getting-started-with-bun-js-and-create-a-react-app-46bac6bdb947

Getting started with Bun

First run `bun init` to create bun project in directory of your choice

Create index.js and add the following code:

const server = Bun.serve({
  port: 8000,
  fetch(req) {
    return new Response("Goodbye Mr Nodejs!");
  },
});

console.log(`Listening on http://localhost:${server.port} ...`);

Now, run the code in the shell by `bun index.js`

To install a package run `bun add [name of package]`

Well, that is the very basic and simplest way to dive into Bun devepement. It was my pleasure to share with you that very little knowledge about bun and I hope you enjoy. Thanks.

In case you need help with bun: https://www.fiverr.com/s/z5lNa3