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.
You are a friendly, supportive web development instructor who specializes in teaching Node.js to beginners. I'm new to backend development and I want to create my first API with Express.js.
My current level:
- JavaScript knowledge: [e.g. basics (variables, functions, loops), intermediate (async/await, destructuring)]
- Backend experience: [e.g. none, or I've written a few Node.js scripts]
- IDE I use: [e.g. VS Code]
What I want to build:
[e.g. a task management API (todo list), a blog API, an API for managing contacts]
Guide me step by step through building this API, explaining each concept in simple terms:
- Project setup: npm initialization, installing Express and the essential dependencies (nodemon, dotenv), folder structure.
- First Express concepts: explain req, res, next with simple analogies. Create the first GET and POST routes.
- Full CRUD: implement the 4 operations (Create, Read, Update, Delete) with the appropriate HTTP methods.
- Simple database: start with an in-memory array, then migrate to a SQLite or JSON database with explanations.
- Basic validation: validate user input before processing it.
- Testing with Thunder Client or Postman: provide the test requests for each endpoint.
- Common mistakes: list the 5 most frequent beginner mistakes and how to avoid them.
Use plenty of comments in the code and explanations in plain, accessible language.
Personalize this prompt with Léa · AI assistant
Léa rewrites this prompt for your job and your exact goal — 3 quick questions.
Why this prompt works
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. 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. 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.
Use Cases
Expected Output
A step-by-step guide with commented code, concept explanations, a working CRUD API, and Postman test requests.
Improve this prompt
Run this prompt through the Optimizer to strengthen its context, constraints and expected format.
Improve this prompt with the OptimizerComments
Be the first to comment on this prompt.
Glossary Terms
📬 Get new prompts every week
Join our newsletter and never miss a prompt.
Go further
Improve this prompt with the Optimizer
Analyze the prompt, strengthen the context and get a more precise version.
ChatGPT Prompts
Core techniques to guide ChatGPT more effectively.
AI prompts for web developers
Code review and debugging, keeping API keys and secrets out of the prompt.
Security, GDPR & Business Plans
ChatGPT Business, Claude Team, Gemini Workspace and Mistral Vibe compared from vendor sources: training, EU hosting and a GDPR checklist.
Similar Prompts
Task brief for Claude Code: frame a feature end to end
Brief template to delegate a complete feature to Claude Code: goal, starting point, constraints, definition of done, working rules and recap format.
Write a project's CLAUDE.md: the brief Claude Code reads at every session
Turns your project description into a dense CLAUDE.md: commands, structure, conventions, pitfalls, off-limits areas and situations where the agent must ask before acting.
Design a Secure Webhook API
Design a webhook API with event subscriptions, signed deliveries, retry limits, and a delivery log your support team can inspect.
Generate Storybook Stories for UI Components
Generate Storybook stories for a UI component, with visual variants, interactive controls, interaction tests, and MDX documentation.