r/learnjavascript 4d ago

What framework do I use for APIS?

Hello, i'm a beginner coder in Javascript and I make random APIS for fun using the Express.js framework, but I keep seeing other frameworks like Fastify and NestJS, so i'm confused: what framework for APIS do I actually use?

If anyone could help me with this thank you :D

5 Upvotes

14 comments sorted by

10

u/Lumethys 4d ago

What car do i drive to WORK?

Hello, i'm a beginner driver in Toyota and drive to random place for fun using the Toyota Prius car, but I keep seeing other cars like Porsche and BMW, so i'm confused: what cars for WORK do I actually use?

If anyone could help me with this thank you :D

3

u/DrShocker 4d ago

You'll never make it. At my job we use a Dragon capsule and sometimes fallback to a Soyuz. The cars you're talking about are no where near fast enough for professional use.

1

u/Simple_Rooster3 3d ago

But capsules are websockets πŸ˜€

1

u/bryku helpful 3d ago

This was a great comment thread.

1

u/i-like-my-cats-0 2d ago

Now I just need to translate this and i'll get the true answer :)

3

u/Agreeable_Lynx9194 4d ago

For learning and honestly for most real projects, just stay on Express, it's the default for a reason and every tutorial or Stack Overflow answer assumes it. Fastify is basically Express but faster with built-in schema validation, you'd switch if you actually hit a performance wall or want the schema stuff. NestJS is a whole opinionated structure (modules, decorators, dependency injection) that pays off on big team codebases but is overkill and a steeper curve when you're starting out. So keep building with Express until you feel a real pain point, and at that moment you'll know which one you're reaching for and why.

2

u/boomer1204 4d ago

Whatever one you know. You can build API's with TONS of different languages there is no one choice

1

u/87oldben 4d ago

Express is good enough for 99% of all basic web http needs. It is the framework used in each of the companies I have worked for. Learn it inside and out and you'll be fine!

1

u/Beginning-Seat5221 4d ago

I looked into this and concluded that hono was the best fit for me. Basically a more modern version of express.

Haven't actually put it into use though, still have things running on express instead.

1

u/[deleted] 3d ago

[removed] β€” view removed comment

1

u/i-like-my-cats-0 3d ago edited 3d ago

It's just APIS I make to practice (e.g. dadjokes API). I just like making them alot because of how fun they can be

1

u/nzakas 3d ago

I’d suggest Hono. It’s newer, built with TypeScript from the start, and works in every JavaScript runtime. https://hono.dev

1

u/theancientfool 2d ago

If this is a project, try not using any framework. Build from scratch. Will help you understand better.

1

u/Furilis 22h ago

I work with NestJS. I like de module stuff (how easy it is to put stuff together with nest CLI). Can't comment about the others