1.0.8 • Published 1 year ago

next-crud-automation v1.0.8

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

Next Crud Automation

What is Next Crud Automation ?

Next Crud Automation is an api wrapper for Next.js and Prisma

This library can be only be used in a Next.js app at the moment

Getting started

The fastest way to get started is to create a new file in your api folder, and paste the following code:

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

import ApiWrapper from 'next-crud-automation/lib';
import { PrismaClient } from '@prisma/client';

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

Now this function will host the following routes:

  • GET /api/table
  • POST /api/table
  • PATCH /api/table/id
  • DELETE /api/table/id

Note:

  • table is the name of the table you want to access. Lowercase only
  • id is the primary key of a record

Examples

  • GET /api/user will return a list of records of the user Model
  • PATCH /api/user/1 will update a row where it's primary key is 1

Incoming features

  • Field encryption
  • Hide field from GET calls
  • Express.js adaptor
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