P
💻DeveloppementBeginnerChatGPT

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

Adapt this prompt

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:

  1. Project setup: npm initialization, installing Express and the essential dependencies (nodemon, dotenv), folder structure.
  2. First Express concepts: explain req, res, next with simple analogies. Create the first GET and POST routes.
  3. Full CRUD: implement the 4 operations (Create, Read, Update, Delete) with the appropriate HTTP methods.
  4. Simple database: start with an in-memory array, then migrate to a SQLite or JSON database with explanations.
  5. Basic validation: validate user input before processing it.
  6. Testing with Thunder Client or Postman: provide the test requests for each endpoint.
  7. 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

Learning backend developmentNode.js and Express trainingCreating first personal projects

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 Optimizer

Comments

Be the first to comment on this prompt.

📬 Get new prompts every week

Join our newsletter and never miss a prompt.

Go further

Similar Prompts

💻DeveloppementIntermediateClaude

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.

1685
💻DeveloppementIntermediateClaude

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.

641
💻DeveloppementAdvancedAll AIs

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.

411
💻DeveloppementIntermediateAll AIs

Generate Storybook Stories for UI Components

Generate Storybook stories for a UI component, with visual variants, interactive controls, interaction tests, and MDX documentation.

476