0.4.10 • Published 1 year ago

next-api-handler v0.4.10

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

install size CircleCI codecov next-api-handler Known Vulnerabilities

Lightweight and Portable Next.js API builder

Building RESTful API routes in Next.js with middleware support, predictable error handling and type-safe interfaces for client-server communication.

Visit https://next-api-handler.vercel.app to view the full documentation.

Getting Started

TL;DR

npm install next-api-handler # or yarn, pnpm
// in /pages/api/users.ts
import { RouterBuilder, ForbiddenException } from 'next-api-handler';
import { createUser, type User } from '@/services/user';

const router = new RouterBuilder();

router
  .get<string>(() => 'Hello World!')
  .post<User>(async (req) => createUser(req.body))
  .delete(() => {
    throw new ForbiddenException();
  });

export default router.build();

License

MIT

0.4.9

1 year ago

0.4.10

1 year ago

0.4.8

1 year ago

0.4.6-alpha.3

1 year ago

0.4.6-alpha.0

1 year ago

0.4.6-alpha.2

1 year ago

0.4.6-alpha.1

1 year ago

0.4.5

1 year ago

0.4.4

1 year ago

0.4.7

1 year ago

0.4.6

1 year ago

0.4.1

1 year ago

0.4.0

1 year ago

0.4.3

1 year ago

0.4.2

1 year ago

0.3.2

2 years ago

0.3.1

2 years ago

0.3.0

2 years ago

0.2.6

2 years ago

0.2.5

2 years ago

0.1.0

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.4

2 years ago

0.0.7

2 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago