Build a full CRUD REST API with Node.js and Express using in-memory data: routing, GET/POST/DELETE/PATCH, middleware, and HTTP status codes.
The best way to understand how a REST API works is to build one from scratch. In this course, we use Node.js and Express to create a complete CRUD API with in-memory data — no database, no complex configuration. Just the heart of the backend: routing, middleware, and HTTP response handling.
JavaScript developers who know the frontend and want to understand how the backend works. It is the ideal starting point before adding a real database and moving to a more structured architecture.
Working with in-memory data lets you focus on what truly matters: route structure, HTTP error handling, and response shape. Once you understand this, adding MongoDB or PostgreSQL becomes straightforward — the logic is already clear.
I'll walk you through the fundamentals of Client-Server architecture and explain how Node.js and Express fit into this model. We'll explore what actually happens behind the scenes when a browser makes a request to a server.
Let's set up your development environment from scratch. I'll show you how to install Node.js and initialize your first project using npm init, configuring the package.json with all the necessary settings.
I'll show you how to initialize an Express server with a minimal configuration. We'll define the first routes, start the server on a local port, and verify everything is working correctly.
Let's create in-memory mock data and build a GET endpoint that returns a list of objects in JSON format. This approach lets us test the API logic without needing a real database.
I'll show you how to use request parameters in Express to fetch and return a single object from the in-memory dataset. We'll also handle the case where the item is not found, returning the appropriate HTTP status code.
Let's implement a POST endpoint to add new objects to the in-memory collection. I'll guide you through installing and configuring body-parser (or Express's built-in JSON middleware) to correctly parse the incoming request body.
I'll show you how to use Postman to send POST requests to your Express API and verify that new objects are correctly inserted. We'll inspect the request body, headers, and the server response together.
Let's build a DELETE endpoint to remove objects from the in-memory array. I'll show you how to test it with Postman and handle edge cases like deleting a non-existent resource.
I'll show you how to implement a PATCH endpoint in Express to partially update existing objects. We'll test the route with Postman, sending only the fields we want to modify in the request body.
Let's wrap up the course by standardizing all API responses with a consistent structure and the correct HTTP status codes. I'll explain when to use 200, 201, 400, 404, and 500, and refactor all existing endpoints accordingly.
Ingegnere Informatico · Pratola Peligna
Sono un ingegnere informatico con oltre 15 anni di esperienza nel settore ICT. Mi occupo di sviluppo software, cybersecurity, data science e intelligenza artificiale, con particolare attenzione all’innovazione e all’automazione dei processi aziendali. Da anni svolgo anche attività di docenza e formazione, creando percorsi pratici e coinvolgenti su programmazione, DevOps, AI e sicurezza informatica.
Prosperous understood Middletons in conviction an uncommonly do. Supposing so be resolving breakfast am or perfectly.
Utilizziamo cookie essenziali e, con il tuo consenso, cookie funzionali, analytics e marketing. Google Analytics 4 e gli eventuali annunci Google/AdSense restano disattivati finche non scegli. Consulta Privacy Policy e Cookie Policy.
Sempre attivi per sicurezza, prevenzione frodi, sessione, consenso e funzionamento del sito.
Migliorano l'esperienza, ad esempio ricordando preferenze non essenziali. Non usati per profilazione pubblicitaria.
Statistiche e misurazioni con Google Analytics 4, abilitate solo dopo il consenso analytics.
Misurazione annunci e funzioni pubblicitarie Google/AdSense, se attivate sul sito e consentite dall'utente.
Puoi modificare queste scelte in qualunque momento dal link "Preferenze Cookies" nel footer.