Programming Tips πŸ’‘
51.6K subscribers
67 photos
10 videos
30 files
354 links
Programming & AI:
Tips πŸ’‘
Articles πŸ“•
Resources πŸ‘Ύ
Design Patterns πŸ’Ž
Software Principles βœ…

πŸ‡³πŸ‡± Contact: @MoienTajik

🎯 Buy ads: https://telega.io/c/ProgrammingTip
Download Telegram
Fasify.io ⚑️

An efficient server implies a lower cost of the infrastructure, a better responsiveness under load and happy users. πŸ€“

How can you efficiently handle the resources of your server, knowing that you are serving the highest number of requests as possible, without sacrificing security validations and handy development ⁉️

Enter Fastify. Fastify is a web framework highly focused on providing the best developer experience with the least overhead and a powerful plugin architecture. It is inspired by Hapi and Express and as far as we know, it is one of the fastest web frameworks in town. πŸ”₯

Install πŸ“₯
npm install fastify --save


πŸ”ΉπŸ”ΈπŸ”ΉπŸ”Έ


[ Example ]

// Require the framework and instantiate it
const fastify = require("fastify") ()

// Declare a route
fastify.get("/", function (request, reply) {
reply.send({ hello: "world" })
})

fastify.listen(3000, function (err) {
if (err) throw err
console.log(`server listening on ${fastify.server.address().port}`)
})


πŸ”ΉπŸ”ΈπŸ”ΉπŸ”Έ


[ Async-Example ]

const fastify = require('fastify')()

fastify.get('/', async (request, reply) => {
reply.type('application/json').code(200)
return { hello: 'world' }
})

fastify.listen(3000, function (err) {
if (err) throw err
console.log(`server listening on ${fastify.server.address().port}`)
})


https://t.me/pgimg/102


[ Website ] : https://www.fastify.io

γ€°γ€°γ€°γ€°γ€°γ€°
#JavaScript #NPM #Fastify
@ProgrammingTip
What Happened When I Peeked Into My Node_Modules Directory 🀯

The left-pad fiasco shook the JavaScript community to its core when a rouge developer removed a popular module from npm, causing tens of projects to go dark. ❌

While code bloat continues to slow down our websites, drain our batteries, and make β€œnpm install” slow for a few seconds, many developers like myself have decided to carefully audit the dependencies we bring into our projects. πŸŒ€

It’s time we as a community stand up and say enough is enough, this community belongs to all of us, not just a handful of JavaScript developers with great hair. πŸ‘₯

I decided to document my experiences in auditing my projects’ dependencies, and I hope you find the following information useful. βœ…


https://t.me/pgimg/173

[ Article ] : kutt.it/nmo

γ€°γ€°γ€°γ€°γ€°γ€°
#JavaScript #NPM
@ProgrammingTip