2.0.37 • Published 5 months ago

@visulima/crud v2.0.37

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

OpenAPI (Swagger) specification, node-rate-limiter-flexible, @visulima/connect

With a more intuitive API for creating HTTP API endpoints.

typescript-image npm-image license-image



Features

Installation

npm install @visulima/crud prisma @prisma/client
yarn add @visulima/crud prisma @prisma/client
pnpm add @visulima/crud prisma @prisma/client

Usage

To use the @visulima/crud package, you need to have a Prisma schema.

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

// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import type { NextApiRequest, NextApiResponse } from "next";
import { PrismaAdapter } from "@visulima/crud";
import { nodeHandler } from "@visulima/crud/next";
import type { User, Post, Prisma } from "@prisma/client";

import { prisma } from "../../lib/prisma-client";

const prismaAdapter = new PrismaAdapter<User | Post, Prisma.ModelName>({
    prismaClient: prisma,
});

export default async (request, response) => {
    const handler = await nodeHandler<User | Post, any, NextApiRequest, NextApiResponse, Prisma.ModelName>(prismaAdapter);

    await handler(request, response);
};

To use it with api-platform connect you need to install the @visulima/api-platform package.

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

// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import type { NextApiRequest, NextApiResponse } from "next";
import { createNodeRouter } from "@visulima/api-platform";
import { PrismaAdapter } from "@visulima/crud";
import { nodeHandler } from "@visulima/crud/next";
import type { User, Post, Prisma } from "@prisma/client";

import { prisma } from "../../lib/prisma-client";

const prismaAdapter = new PrismaAdapter<User | Post, Prisma.ModelName>({
    prismaClient: prisma,
});

const router = createNodeRouter<NextApiRequest, NextApiResponse>().all(async (request, response) => {
    const handler = await nodeHandler<User | Post, any, NextApiRequest, NextApiResponse, Prisma.ModelName>(prismaAdapter);

    await handler(request, response);
});

export default router.handler();

Supported Node.js Versions

Libraries in this ecosystem make the best effort to track Node.js’ release schedule. Here’s a post on why we think this is important.

Contributing

If you would like to help take a look at the list of issues and check our Contributing guild.

Note: please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Credits

License

The visulima crud is open-sourced software licensed under the MIT

typescript-url: https://www.typescriptlang.org/ "TypeScript" "typescript"

2.0.37

5 months ago

2.0.35

6 months ago

2.0.36

5 months ago

2.0.34

7 months ago

2.0.33

8 months ago

2.0.32

10 months ago

2.0.31

10 months ago

2.0.28

11 months ago

2.0.29

11 months ago

2.0.30

11 months ago

2.0.27

11 months ago

2.0.26

12 months ago

2.0.24

1 year ago

2.0.25

1 year ago

2.0.23

1 year ago

2.0.22

1 year ago

2.0.21

1 year ago

2.0.20

1 year ago

2.0.19

1 year ago

2.0.18

1 year ago

2.0.17

1 year ago

2.0.15

1 year ago

2.0.16

1 year ago

2.0.14

1 year ago

2.0.13

1 year ago

2.0.12

2 years ago

2.0.11

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

2.0.7

2 years ago

2.0.6

2 years ago

2.0.9

2 years ago

2.0.10

2 years ago

2.0.8

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.11

2 years ago

1.0.12

2 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago