Saltar al contenido
Marketplace

nodejs-express-server

de aj-geddes

Build production-ready Express.js servers with middleware, authentication, routing, and database integration. Use when creating REST APIs, managing requests/responses, implementing middleware chains, and handling server logic.

Esta skill incluye scripts que tu agente puede ejecutar. Ver qué archivos

Resumen

SKILL.mdLeída en 3f5182c

Node.js Express Server

Table of Contents

  • Overview
  • When to Use
  • Quick Start
  • Reference Guides
  • Best Practices

Overview

Create robust Express.js applications with proper routing, middleware chains, authentication mechanisms, and database integration following industry best practices.

When to Use

  • Building REST APIs with Node.js
  • Implementing server-side request handling
  • Creating middleware chains for cross-cutting concerns
  • Managing authentication and authorization
  • Connecting to databases from Node.js
  • Implementing error handling and logging

Quick Start

Minimal working example:

const express = require("express");
const app = express();
const PORT = process.env.PORT || 3000;

// Middleware
app.use(express.json());
app.use(express.urlencoded({ extended: true }));

// Routes
app.get("/health", (req, res) => {
  res.json({ status: "OK", timestamp: new Date().toISOString() });
});

// Error handling
app.use((err, req, res, next) => {
  console.error(err.stack);
  res.status(err.status || 500).json({
    error: err.message,
    requestId: req.id,
  });
});

app.listen(PORT, () => {
  console.log(`Server running on port ${PORT}`);
});

Reference Guides

Detailed implementations in the references/ directory:

GuideContents
Basic Express SetupBasic Express Setup
Middleware Chain ImplementationMiddleware Chain Implementation
Database Integration (PostgreSQL with Sequelize)Database Integration (PostgreSQL with Sequelize)
Authentication with JWTAuthentication with JWT
RESTful Routes with CRUD OperationsRESTful Routes with CRUD Operations
Error Handling MiddlewareError Handling Middleware
Environment ConfigurationEnvironment Configuration

Best Practices

✅ DO
  • Use middleware for cross-cutting concerns
  • Implement proper error handling
  • Validate input data before processing
  • Use async/await for async operations
  • Implement authentication on protected routes
  • Use environment variables for configuration
  • Add logging and monitoring
  • Use HTTPS in production
  • Implement rate limiting
  • Keep route handlers focused and small
❌ DON'T
  • Handle errors silently
  • Store sensitive data in code
  • Use synchronous operations in routes
  • Forget to validate user input
  • Implement authentication in route handlers
  • Use callback hell (use promises/async-await)
  • Expose stack traces in production
  • Trust client-side validation only

Archivos 9 archivos

Instálala a mano

Deska ejecuta esto por ti, para cada agente que elijas. Para ejecutarlo tú en una terminal:

npx skills add aj-geddes/useful-ai-prompts --skill nodejs-express-server

Más de aj-geddes

  • code-review-analysisaj-geddesPerform comprehensive code reviews with best practices, security checks, and constructive feedback. Use when reviewing pull requests, analyzing code quality, checking for security vulnerabilities, or providing code improvement suggestions.2,400 instalaciones en skills.sh0
  • rest-api-designaj-geddesDesign RESTful APIs following best practices for resource modeling, HTTP methods, status codes, versioning, and documentation. Use when creating new APIs, designing endpoints, or improving existing API architecture.2,000 instalaciones en skills.sh0
  • architecture-diagramsaj-geddesCreate system architecture diagrams using Mermaid, PlantUML, C4 model, flowcharts, and sequence diagrams. Use when documenting architecture, system design, data flows, or technical workflows.1,900 instalaciones en skills.sh0
  • jenkins-pipelineaj-geddesBuild Jenkins declarative and scripted pipelines with stages, agents, parameters, and plugins. Implement multi-branch pipelines and deployment automation.1,800 instalaciones en skills.sh0
Todas las skills de aj-geddes