Nodejs express server

From aj-geddes/useful-ai-prompts · View interactive version

Nodejs express server is an AI agent skill from the GitHub repository aj-geddes/useful-ai-prompts. 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.

How to use this skill

Skill file

Node.js Express Server

Table of Contents

Overview

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

When to Use

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:

| Guide | Contents |

|---|---|

| Basic Express Setup | Basic Express Setup |

| Middleware Chain Implementation | Middleware Chain Implementation |

| Database Integration (PostgreSQL with Sequelize) | Database Integration (PostgreSQL with Sequelize) |

| Authentication with JWT | Authentication with JWT |

| RESTful Routes with CRUD Operations | RESTful Routes with CRUD Operations |

| Error Handling Middleware | Error Handling Middleware |

| Environment Configuration | Environment Configuration |

Best Practices

✅ DO

❌ DON'T

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.