1.1.2 • Published 1 year ago

@jigolka/next-crud v1.1.2

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

Next Crud

NPM version License

What is Next Crud ?

Next Crud is an api wrapper for Next.js and Prisma that handle automatically CRUD endpoints.

Documenation

You can access the full documentation at next-crud-docs.vercel.app

Getting started

npm install @jigolka/next-crud

Given this specific schema:

model User {
  id      String  @id @default(cuid())
  name    String
  email   String
}

Paste the following snippet to get you started:

// pages/api/[...crud].ts

import ApiWrapper from "@jigolka/next-crud"

import { PrismaClient } from "@prisma/client"

export default ApiWrapper({
  prismaInstance: new PrismaClient(),
})

This will generate these differents endpoints:

EndpointDescription
GET /api/userGet all the users
GET /api/user/[id]Get one user
POST /api/userCreate one user
PATCH /api/user/[id]Update one user
DELETE/api/user/[id]Delete one user

Contributing

Pull requests are welcome!

1.1.1

1 year ago

1.1.2

1 year ago

1.1.0

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago