mcpField
N
nodejs-express-server

nodejs-express-server

github.com/midudevDevelopment7.0k60 installsUpdated 2w ago
Repository

About nodejs-express-server

A reference skill for building Node.js applications with Express, for developers implementing APIs and server-side request handling. It provides setup guidance and focused guides for middleware, databases, authentication, routes, and errors.

Key features

  1. 01Guidance for Express setup and routing
  2. 02Middleware chain implementation
  3. 03PostgreSQL integration with Sequelize
  4. 04JWT authentication guidance
  5. 05CRUD routes and error-handling references
  6. 06Configuration and server best practices

Use cases

  1. 01Building REST APIs with Node.js
  2. 02Adding middleware for cross-cutting concerns
  3. 03Connecting an Express application to PostgreSQL
  4. 04Implementing protected routes and error handling

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/midudev/autoskills --skill nodejs-express-server

After installing, type/nodejs-express-serverin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

references/
authentication-with-jwt.md
basic-express-setup.md
database-integration-postgresql-with-sequelize.md
environment-configuration.md
error-handling-middleware.md
middleware-chain-implementation.md
restful-routes-with-crud-operations.md
scripts/
security-checklist.sh

Details

From the project README

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

  • 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

Comments

Markdown supported