Registry / web-framework / expresss

expresss

JSON →
library0.0.0jsnpmunverified

Express.js is a foundational, unopinionated web application framework for Node.js, widely regarded as the de facto standard for building web applications and APIs. It provides a robust yet minimalist set of features, including a powerful routing system, HTTP utility methods, and a flexible middleware architecture. The current stable major version is Express 5.x, with Express 5.1.0 being the default on npm, and an official LTS schedule supports both v4 and v5 release lines. The release cadence for major versions can be extended, as seen with the significant time between Express 4 and Express 5, which focused on improving core stability, aligning with modern Node.js features, and incorporating security enhancements rather than introducing a vast array of new features. Its key differentiators include its lightweight nature, high extensibility through a vast ecosystem of middleware, and its "unopinionated" approach, allowing developers significant freedom in structuring their applications and choosing components like ORMs and template engines. It is often a core component of the "MEAN" or "MERN" stack for full-stack JavaScript development. Note: The package 'expresss' is a likely typo; this entry refers to the correct package 'express'.

npm install expresss
INSTALL
IMPORT
SIG · EXPRESSS
E
expresss
web-frameworkjavascriptv0.0.0
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

express
✓ import express from 'express';
✗ const express = require('express');
ESM import style, requires 'type': 'module' in package.json or a .mjs file extension. Node.js 18+ is recommended for modern ESM usage with Express 5.
express
✓ const express = require('express');
✗ import express from 'express';
CommonJS (CJS) require style, the traditional way to import Express in Node.js applications. This is the default in Node.js unless explicitly configured for ESM.
Router
✓ import { Router } from 'express';
✗ import Router from 'express/lib/router';
While `express` itself is a default export, you can specifically import `Router` for modular route handling without creating a full application instance. However, typically `express.Router()` is used.

This quickstart sets up a basic Express.js server with two routes: a root path returning 'Hello World!' and an API endpoint returning JSON data. It demonstrates server initialization and route handling. Ensure 'type': 'module' in package.json for ESM imports or use require().

import express from 'express'; const app = express(); const port = process.env.PORT ?? 3000; app.get('/', (req, res) => { res.send('Hello from Express.js!'); }); app.get('/api/data', (req, res) => { res.json({ message: 'This is some API data!', timestamp: new Date() }); }); app.listen(port, () => { console.log(`Express app listening on port ${port}`); console.log(`Access at http://localhost:${port}`); });
Debug
Known issues
breakingExpress 5.x requires Node.js version 18 or higher. Applications running on older Node.js versions must be upgraded before migrating to Express 5.
fix
Upgrade Node.js to version 18 or later. Use `nvm` or your preferred Node.js version manager for easy switching: `nvm install 18 && nvm use 18`.
affects: >=5.0.0
breakingSeveral deprecated method signatures from Express 4 have been removed in Express 5, including `app.del()`, `res.send(status, body)`, `res.send(status)`, `res.redirect('back')`, and `res.json(obj, status)`.
fix
Use `app.delete()` instead of `app.del()`. For response methods, chain `res.status(statusCode).send(body)` or `res.sendStatus(statusCode)`. Replace `res.redirect('back')` with `res.redirect(req.get('Referrer') || '/')`. Consult the official migration guide for specific replacements.
affects: >=5.0.0
breakingThe path route matching syntax has stricter rules in Express 5, particularly concerning named wildcards (`*`) and regular expressions. For instance, `/*` should now be `/*splat`.
fix
Review and update all route path definitions to conform to the new stricter syntax. Use named wildcards like `/*splat` for wildcard matches. Refer to the 'Migrating to Express 5' documentation for detailed examples.
affects: >=5.0.0
breakingBody parsing behavior has changed in Express 5. `req.body` is no longer initialized to an empty object by default, and the `urlencoded` middleware's `extended` option now defaults to `false`. The standalone `bodyParser()` middleware is also removed.
fix
Ensure `express.json()` and `express.urlencoded({ extended: true })` (if needed) middleware are explicitly added to your application. Access `req.body` only after these middleware have processed the request.
affects: >=5.0.0
gotchaIn Express 5, rejected promises returned from asynchronous middleware and route handlers are now automatically caught and forwarded to the error-handling middleware. This simplifies async error handling but might alter behavior for applications that previously handled rejections manually.
fix
Review your asynchronous route handlers and middleware. Remove redundant `try/catch` blocks that just call `next(err)`, as Express 5 now handles this automatically. Ensure your main error-handling middleware is correctly set up to catch these forwarded errors.
affects: >=5.0.0
Errors
Common errors & fixes
TypeError: app.del is not a function
Attempting to use the deprecated `app.del()` method in Express 5.
fix
Replace `app.del('/path', handler)` with `app.delete('/path', handler)`.
TypeError: Cannot read properties of undefined (reading 'body') or req.body is undefined
The body parsing middleware (`express.json()` or `express.urlencoded()`) is missing or incorrectly applied, especially in Express 5 where `req.body` is not initialized by default.
fix
Add `app.use(express.json());` and/or `app.use(express.urlencoded({ extended: true }));` (if parsing URL-encoded data) before your routes that access `req.body`.
ERR_REQUIRE_ESM or TypeError: require is not a function (when using import)
Mixing CommonJS `require()` syntax with ES Modules `import` syntax without proper configuration, or attempting to use `require()` in a file treated as an ESM module.
fix
Ensure consistency in your module system. If using ES Modules (with `"type": "module"` in `package.json` or `.mjs` files), use `import` statements. If sticking to CommonJS, use `require()`. For specific cases needing both, consider dynamic `import()` or `createRequire` in Node.js.
Upgrade
Version history
0.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
19 hits · last 30 days
node
16
OpenAI (training)
1
Resources