nexpresst
v2.2.0
Published
Write express-like APIs with Next.js serverless functions
Downloads
53
Maintainers
Readme
Nexpresst 🚀
Nexpresst is a lightweight TypeScript utility designed to build Express-like API routes in Next.js applications. It leverages the Next.js App Router's file-based routing system, providing a structured way to handle HTTP methods, middleware, and response processing—all with strong TypeScript support.
⚠️ Note: This version requires Next.js >= 15.0.0. For Next.js < 15.0.0, please use Nexpresst version 1.X.X.
Features
- Express-like Routing: Use familiar patterns from Express to create API routes in Next.js.
- Express Middleware Adapter: You can leverage existing Express-compatible middleware like
helmet,compression,csurfandcorsin your Next.js API routes with theexpressMiddlewareAdapter. - Custom Middleware Support: Define global and route-specific middleware for fine-grained request handling.
- Strong TypeScript Support: Utilize TypeScript generics for type-safe request handlers and middleware, ensuring robust and predictable API interactions.
- Easy Integration: Seamlessly integrate with Next.js's App Router and next/server module for a smooth development experience.
Quick Start
npm install nexpresstDocumentation
- Installation - Installation instructions
- Getting Started - Setting up the router and creating your first routes
- Middleware - Using Express-compatible middleware and creating custom middleware
- TypeScript Support - Type-safe route handlers and middleware
- Error Handling - Handling errors gracefully
- Catch-All Routes - Custom 404 responses for non-existent routes
- Examples - Example projects and implementations
- Contributing - How to contribute to Nexpresst
License
This project is licensed under the MIT License. See the LICENSE file for details.
