DevLearn

Node.js Basics

Learn how to set up a Node.js server, handle routes, and work with middleware.

const http = require('http');
const server = http.createServer((req, res) => {
  res.writeHead(200, {'Content-Type':'text/plain'});
  res.end('Hello, World!');
});
server.listen(3000, () => console.log('Server running on port 3000'));

Express.js Routing

Master routing, request handling, and JSON responses with Express.

const express = require('express');
const app = express();
app.get('/', (req, res) => res.send('Welcome to Express!'));
app.get('/api/users', (req, res) => {
  res.json([{id:1,name:'Alice'},{id:2,name:'Bob'}]);
});
app.listen(4000, () => console.log('Express listening on 4000'));

REST API with FastAPI (Python)

Build a fast, type‑hinted REST API using Python's FastAPI framework.

from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def read_root():
    return {"message": "Hello from FastAPI"}
@app.get("/items/{item_id}")
def read_item(item_id: int, q: str = None):
    return {"item_id": item_id, "q": q}