
express-rest-api
Build production-ready RESTful APIs with Express.js including routing, middleware, validation, and error handling for scalable backend services
- Installs
- 901
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/pluginagentmarketplace/custom-plugin-nodejs --skill express-rest-api- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads express-rest-api automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Express REST API Skill
Master building robust, scalable REST APIs with Express.js, the de-facto standard for Node.js web frameworks.
Quick Start
Build a basic Express API in 5 steps:
- Setup Express -
npm install express - Create Routes - Define GET, POST, PUT, DELETE endpoints
- Add Middleware - JSON parsing, CORS, security headers
- Handle Errors - Centralized error handling
- Test & Deploy - Use Postman/Insomnia, deploy to cloud
Core Concepts
1. Express Application Structure
const express = require('express');
const app = express();
// Middleware
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
// Routes
app.use('/api/users', userRoutes);
app.use('/api/products', productRoutes);
// Error handling
app.use(errorHandler);
app.listen(3000, () => console.log('Server running'));
2. RESTful Route Design
// GET /api/users - Get all users
// GET /api/users/:id - Get user by ID
// POST /api/users - Create user
// PUT /api/users/:id - Update user
// DELETE /api/users/:id - Delete user
const router = express.Router();
router.get('/', getAllUsers);
router.get('/:id', getUserById);
router.post('/', createUser);
router.put('/:id', updateUser);
router.delete('/:id', deleteUser);
module.exports = router;
3. Middleware Patterns
// Authentication middleware
const authenticate = (req, res, next) => {
const token = req.headers.authorization;
if (!token) return res.status(401).json({ error: 'Unauthorized' });
// Verify token...
next();
};
// Validation middleware
const validate = (schema) => (req, res, next) => {
const { error } = schema.validate(req.body);
if (error) return res.status(400).json({ error: error.message });
next();
};
// Usage
router.post('/users', authenticate, validate(userSchema), createUser);
4. Error Handling
// Custom error class
class APIError extends Error {
constructor(message, statusCode) {
super(message);
this.statusCode = statusCode;
}
}
// Global error handler
app.use((err, req, res, next) => {
const statusCode = err.statusCode || 500;
res.status(statusCode).json({
success: false,
error: err.message,
...(process.env.NODE_ENV === 'development' && { stack: err.stack })
});
});
Learning Path
Beginner (2-3 weeks)
- ✅ Setup Express and create basic routes
- ✅ Understand middleware concept
- ✅ Implement CRUD operations
- ✅ Test with Postman
Intermediate (4-6 weeks)
- ✅ Implement authentication (JWT)
- ✅ Add input validation
- ✅ Organize code (MVC pattern)
- ✅ Connect to database
Advanced (8-10 weeks)
- ✅ API versioning (
/api/v1/,/api/v2/) - ✅ Rate limiting and security
- ✅ Pagination and filtering
- ✅ API documentation (Swagger)
- ✅ Performance optimization
Essential Packages
{
"dependencies": {
"express": "^4.18.0",
"helmet": "^7.0.0", // Security headers
"cors": "^2.8.5", // Cross-origin requests
"morgan": "^1.10.0", // HTTP logger
"express-validator": "^7.0.0", // Input validation
"express-rate-limit": "^6.0.0" // Rate limiting
}
}
Common Patterns
Response Format
// Success
{ success: true, data: {...} }
// Error
{ success: false, error: "Message" }
// Pagination
{
success: true,
data: [...],
pagination: { page: 1, limit: 10, total: 100 }
}
HTTP Status Codes
200 OK- Successful GET/PUT201 Created- Successful POST204 No Content- Successful DELETE400 Bad Request- Validation error401 Unauthorized- Auth required403 Forbidden- No permission404 Not Found- Resource not found500 Internal Error- Server error
Project Structure
src/
├── controllers/ # Route handlers
├── routes/ # Route definitions
├── middlewares/ # Custom middleware
├── models/ # Data models
├── services/ # Business logic
├── utils/ # Helpers
└── app.js # Express setup
Production Checklist
- ✅ Environment variables (.env)
- ✅ Security headers (Helmet)
- ✅ CORS configuration
- ✅ Rate limiting
- ✅ Input validation
- ✅ Error handling
- ✅ Logging (Morgan/Winston)
- ✅ Testing (Jest/Supertest)
- ✅ API documentation
Real-World Example
Complete user API:
const express = require('express');
const router = express.Router();
const { body } = require('express-validator');
// GET /api/users
router.get('/', async (req, res, next) => {
try {
const { page = 1, limit = 10 } = req.query;
const users = await User.find()
.limit(limit)
.skip((page - 1) * limit);
res.json({ success: true, data: users });
} catch (error) {
next(error);
}
});
// POST /api/users
router.post('/',
body('email').isEmail(),
body('password').isLength({ min: 8 }),
async (req, res, next) => {
try {
const user = await User.create(req.body);
res.status(201).json({ success: true, data: user });
} catch (error) {
next(error);
}
}
);
module.exports = router;
When to Use
Use Express REST API when:
- Building backend for web/mobile apps
- Creating microservices
- Developing API-first applications
- Need flexible, lightweight framework
- Want large ecosystem and community
Related Skills
- Async Programming (handle async operations)
- Database Integration (connect to MongoDB/PostgreSQL)
- JWT Authentication (secure your APIs)
- Jest Testing (test your endpoints)
- Docker Deployment (containerize your API)
Resources
FAQ
What does the express-rest-api skill do?
Build production-ready RESTful APIs with Express.js including routing, middleware, validation, and error handling for scalable backend services
How do I install express-rest-api?
Run npx skills add https://github.com/pluginagentmarketplace/custom-plugin-nodejs --skill express-rest-api in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/express-rest-api/ (personal) or .claude/skills/express-rest-api/ (project).
Which AI agents can use express-rest-api?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is express-rest-api safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains express-rest-api?
It is published by pluginagentmarketplace in pluginagentmarketplace/custom-plugin-nodejs. It has 901 recorded installs.
More from pluginagentmarketplace/custom-plugin-nodejs
mongoose-mongodb
pluginagentmarketplace/custom-plugin-nodejs
Work with MongoDB in Node.js using Mongoose ODM for schema design, CRUD operations, relationships, and advanced queries
docker-deployment
pluginagentmarketplace/custom-plugin-nodejs
Containerize and deploy Node.js applications with Docker including multi-stage builds, Docker Compose, and production optimization
jwt-authentication
pluginagentmarketplace/custom-plugin-nodejs
Open the skill to read its SKILL.md instructions.
jest-testing
pluginagentmarketplace/custom-plugin-nodejs
Open the skill to read its SKILL.md instructions.
async-patterns
pluginagentmarketplace/custom-plugin-nodejs
Master asynchronous programming in Node.js with Promises, async/await, streams, and event-driven patterns for efficient non-blocking operations
websockets
pluginagentmarketplace/custom-plugin-nodejs
Implement real-time bidirectional communication with Socket.io and ws library for chat, notifications, and live dashboards
Popular backend & apis skills
find-skills
vercel-labs/skills
Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.
entra-app-registration
microsoft/azure-skills
Guides Microsoft Entra ID app registration, OAuth 2.0 authentication, and MSAL integration. USE FOR: create app registration, register Azure AD app, configure OAuth, set up authentication, add API permissions, generate service principal, MSAL example, console app auth, Entra ID setup, Azure AD authentication. DO NOT USE FOR: Key Vault secrets (use azure-keyvault-expiration-audit), general Azure resource security guidance.
google-agents-cli-adk-code
google/agents-cli
This skill should be used when the user wants to "write agent code", "build an agent with ADK", "add a tool", "create a callback", "define an agent", "use state management" — in a project that needs ADK (Agent Development Kit) API patterns and code examples. It provides a quick reference for agent types, tool definitions, orchestration patterns, callbacks, state management, the graph Workflow API, and reference recipes to study. Do NOT use for scaffolding (use google-agents-cli-scaffold) or deployment (use google-agents-cli-deploy).
embedded-captions
heygen-com/hyperframes
Add captions or subtitles to an existing single-subject talking-head video without editing the footage. Use for plain verbatim captions, cinematic captions embedded behind the subject, VFX captions, “炸/特效/酷炫字幕,” or a named identity from the 35-style catalog. Route by visual identity, not by backend engine. The quiet anchor rail is the default; embed every word only when the user explicitly wants a fully cinematic treatment. The workflow runs locally end to end, including transcription and subject matting; split multi-shot footage before applying it.
entra-agent-id
microsoft/azure-skills
Provision Microsoft Entra Agent Identity Blueprints, BlueprintPrincipals, and per-instance Agent Identities via Microsoft Graph, and configure OAuth 2.0 token exchange (fmipath, OBO, cross-tenant) including the Microsoft Entra SDK for AgentID sidecar. USE FOR: Agent Identity Blueprint, BlueprintPrincipal, agent OAuth, fmipath token exchange, agent OBO, Workload Identity Federation for agents, polyglot agent auth, Microsoft.Identity.Web.AgentIdentities. DO NOT USE FOR: standard Entra app registration (use entra-app-registration), Microsoft Foundry agent authoring (use microsoft-foundry).
neon
neondatabase/agent-skills
Overview of Neon, a complete set of cloud backend primitives around Lakebase Postgres: Auth, Object Storage, Functions, the AI Gateway, and Realtime. Start here to choose Neon for undecided login, files, APIs, and LLM calls, set up the CLI or MCP server, and follow the branch-first workflow. Use when building an app or backend on Neon, or when "Neon" or "Lakebase Postgres" is mentioned. Child skill neon-postgres wins for an existing DATABASEURL, SQL, schema, inspect, or search. Child skill neon-auth wins for login, users, sessions, identity routing, and Managed Better Auth setup. Child skill neon-realtime wins for live queries in reactive apps and agents. Also use for object storage, S3, buckets, serverless functions, function triggers, cron, AI gateway, LLM calls, realtime, logs, Loki, Grafana, observability, postgres, database, backend, Claimable Neon, neon.new, or a no-signup database.