Create Your First API with Express.js
Learn to create your first Express.js REST API from A to Z with pedagogical explanations adapted to beginners.
Paste in your AI
Paste this prompt in ChatGPT, Claude or Gemini and customize the variables in brackets.
Tu es un formateur en développement web bienveillant et pédagogue, spécialisé dans l'enseignement de Node.js à des débutants. Je débute en développement backend et je veux créer ma première API avec Express.js. **Mon niveau actuel :** - Connaissance JavaScript : [EX: bases (variables, fonctions, boucles), intermédiaire (async/await, destructuring)] - Expérience backend : [EX: aucune, ou j'ai fait quelques scripts Node.js] - IDE utilisé : [EX: VS Code] **Ce que je veux créer :** [EX: une API de gestion de tâches (todo list), une API de blog, une API pour gérer des contacts] Guide-moi étape par étape pour créer cette API en expliquant chaque concept de manière simple : 1. **Setup du projet** : initialisation npm, installation d'Express et des dépendances essentielles (nodemon, dotenv), structure de dossiers. 2. **Premiers concepts Express** : explique req, res, next avec des analogies simples. Crée les premières routes GET et POST. 3. **CRUD complet** : implémente les 4 opérations (Create, Read, Update, Delete) avec les méthodes HTTP appropriées. 4. **Base de données simple** : utilise d'abord un tableau en mémoire, puis migre vers une base de données SQLite ou JSON avec explications. 5. **Validation basique** : valide les entrées utilisateur avant de les traiter. 6. **Test avec Thunder Client ou Postman** : fournis les requêtes de test pour chaque endpoint. 7. **Erreurs courantes** : liste les 5 erreurs les plus fréquentes des débutants et comment les éviter. Utilise des commentaires abondants dans le code et des explications en français accessible.
Why this prompt works
<p>This prompt is calibrated for beginners thanks to several key elements: the request for explanations with simple analogies, using in-memory storage first before a real database (reducing initial complexity), and the preventive list of common errors.</p><p>The complexity progression (in-memory array, SQLite, PostgreSQL if desired) is a proven pedagogical approach: exposing a beginner directly to a PostgreSQL database with connection pooling and migrations would be overwhelming. This gradation allows mastering each concept before introducing a new one.</p><p>Requesting ready-to-use Postman/Thunder Client requests is a practical bonus that allows the beginner to test their API immediately without having to learn another tool from scratch at the same time.</p>
Use Cases
Expected Output
A step-by-step guide with commented code, concept explanations, a working CRUD API, and Postman test requests.
Learn more
Check the full skill on Prompt Guide to master this technique from A to Z.
View on Prompt Guide📬 Get new prompts every week
Join our newsletter and never miss a prompt.
Similar Prompts
Debug a Production Error
Quickly analyze a production error with a structured Root Cause Analysis approach and an immediate action plan.
Refactor Legacy Code Step by Step
This prompt guides AI to analyze legacy code and produce a structured refactoring plan with diagnosis, prioritization, tests, and modernized code.
Create a CLI Tool with Node.js
Create a professional Node.js CLI tool with Commander.js, Inquirer, visual feedback, and npm publishing.
Optimize Your SQL Queries and Boost Performance
A complete prompt to analyze, diagnose, and optimize your SQL queries with indexing and rewriting recommendations adapted to your database engine.