🧩 What is Serverless anyway?
Serverless is a model where you write code as a set of functions, and the provider (Vercel, Cloudflare, AWS, Google) runs them on request. You don't rent a server "permanently", but only pay for the actual function calls — like a taxi instead of a car.
The result: faster start, less infrastructure, easier support.
⚙️ We run our API on Vercel (though, in ~10 minutes)
Install the CLI:
npm i -g vercelCreate a project folder:
mkdir my-api && cd my-apiAdd the api/hello.js function file:
export default function handler(req, res) { res.status(200).json({ message: "Hello, world!" }); }Deposit:
vercelThe answer will be a URL like:
https://my-api.vercel.app/api/hello
You can check vercel dev locally.
⏱️ Why does it come out so quickly
There is no manual server setup — the platform will do everything for you.
Scaling "on demand" — no need to keep a powerful instance 24/7.
Payment for actual performance (or free limits for start).
Templates and autoconfig: less documentation — more work.
📌 Ideal cases for Serverless
Prototypes and MVP.
Forms on landing pages (processing requests, webhooks).
Microservices and cron tasks.
Chatbots, notifications, easy APIs.
⚠️ What to pay attention to
Time limit (often 10–30 seconds per request).
Cold start on some platforms.
Not for heavy calculations and long connections.
Binding to the provider (configuration and API features).
🧪 Mini-upgrade: route with parameters
Add an endpoint that greets by name: api/hi.js
export default function handler(req, res) {
const { name = "Guest" } = req.query;
res.status(200).json({ hello: `Hi ${name}!` });
}Request: /api/hi?name=Kodik → response {"hello":"Hi, Kodik!"}
Serverless is a great way to quickly release a working API and not waste time on infrastructure.
📚 Do you want to delve into the topic?
In the attachment Code you will find detailed lessons on various topics, step-by-step exercises, error analysis and convenient practice right on your phone or browser.
And if you want to be aware of the news, new features and useful materials - subscribe to our Telegram channel. It's cozy, businesslike and with love for code ❤️
