https://github.com/bur4kbey/express-superjson
Express middleware for Superjson integration, providing enhanced JSON serialization in HTTP responses.
https://github.com/bur4kbey/express-superjson
express middleware superjson
Last synced: 11 days ago
JSON representation
Express middleware for Superjson integration, providing enhanced JSON serialization in HTTP responses.
- Host: GitHub
- URL: https://github.com/bur4kbey/express-superjson
- Owner: BUR4KBEY
- License: mit
- Created: 2025-03-07T14:17:23.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-07T14:55:45.000Z (over 1 year ago)
- Last Synced: 2025-03-07T14:58:00.418Z (over 1 year ago)
- Topics: express, middleware, superjson
- Language: TypeScript
- Homepage: https://npmjs.com/package/express-superjson
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://npmjs.com/package/express-superjson)
[](https://github.com/BUR4KBEY/express-superjson/actions/workflows/test.yml)
[](https://app.codecov.io/gh/BUR4KBEY/express-superjson)
[](https://github.com/BUR4KBEY/express-superjson/blob/main/LICENSE)
[](https://github.com/BUR4KBEY/express-superjson)
# ๐ [express-superjson](https://npmjs.com/package/express-superjson)
Express middleware that seamlessly integrates [Superjson](https://github.com/blitz-js/superjson) into your Express.js applications, enabling automatic handling of JavaScript built-in types in HTTP responses.
## ๐ Installation
Install the package using your preferred package manager. Here's an example using `pnpm`:
```bash
pnpm add superjson express-superjson
```
## ๐ Example Usage
```ts
import express from 'express';
import superjsonMiddleware from 'express-superjson';
const app = express();
app.use(express.json());
// This middleware must be registered after `express.json()` middleware.
app.use(superjsonMiddleware());
app.get('/', (req, res) => {
res.json({ date: new Date() });
});
app.listen(3000, () => console.log('Application is running on port 3000.'));
```
Send a **GET** request to `http://localhost:3000` and you'll receive a **Superjson** response like below:
```
{
"json": {
"date": "2023-01-01T00:00:00.000Z"
},
"meta": {
"values": {
"date": ["Date"]
}
}
}
```
## ๐งช Code Coverage and Tests
Tests are crucial for ensuring that the library functions as expected. You can review the code coverage reports by visiting [**Codecov**](https://app.codecov.io/gh/BUR4KBEY/express-superjson). The primary objective is to achieve complete coverage of the entire codebase through rigorous testing.
## โ Support
If you find this project useful and would like to support [me](https://github.com/BUR4KBEY), you can do so by visiting [my website](https://burakbey.dev).
