prisma-studio-fastify

0.0.3 • Public • Published

Prisma Studio Fastify Plugin

This Fastify plugin provides an integrated version of Prisma Studio for Fastify applications. It also includes user authentication features.

Warning

Before using this plugin, ensure that your Prisma database has been initialized and your models have been generated. It is essential to have your database schema set up and your models defined properly before integrating Prisma Studio with Fastify using this plugin.

Installation

npm install fastify prisma-studio-fastify 
//or 
npm install git+https://github.com/scribesavant/prisma-studio-fastify.git

Example

const fastify = require("fastify")({ logger: true })
const PrismaStudioFastify = require("prisma-studio-fastify")
const path = require("path")

fastify.register(PrismaStudioFastify, {
    schemaPath: path.join(__dirname, "prisma/schema.prisma"),
    auth: {
        enabled: true,
        default: {
            email: "prisma@prisma.com",
            password: "prisma"
        },
        secret: `a secret with minimum length of 32 characters` // required when auth is enabled
    }
})

fastify.get("/", (req, res) => {
    res.send("Hello World")
})

fastify.listen({ port: 3000 }, (err, address) => {
    console.log(err || "Server started on 3000") // prisma path is https://url:3000/prisma
})

Screenshots

1 1 1

Package Sidebar

Install

npm i prisma-studio-fastify

Weekly Downloads

25

Version

0.0.3

License

MIT

Unpacked Size

3.47 MB

Total Files

70

Last publish

Collaborators

  • squirrelpython