├── backend
├── .dockerignore
├── .gitignore
├── .env.example
├── prisma
│ ├── migrations
│ │ ├── migration_lock.toml
│ │ └── 20221209073755_1
│ │ │ └── migration.sql
│ └── schema.prisma
├── jsconfig.json
├── Dockerfile
├── docker-compose.yml
├── routes
│ └── ProductRoute.js
├── index.js
├── package.json
├── request.rest
├── controller
│ └── ProductController.js
└── package-lock.json
├── frontend
├── .dockerignore
├── src
│ ├── index.css
│ ├── index.js
│ ├── App.js
│ └── components
│ │ ├── AddProduct.jsx
│ │ ├── EditProduct.jsx
│ │ └── ProductList.jsx
├── public
│ ├── robots.txt
│ ├── favicon.ico
│ ├── logo192.png
│ ├── logo512.png
│ ├── manifest.json
│ └── index.html
├── postcss.config.js
├── Dockerfile
├── tailwind.config.js
├── server.js
├── .gitignore
├── docker-compose.yml
├── package.json
└── README.md
├── .prettierrc.json
├── LICENSE.md
└── README.md
/backend/.dockerignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | npm-debug.log
--------------------------------------------------------------------------------
/frontend/.dockerignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | npm-debug.log
--------------------------------------------------------------------------------
/frontend/src/index.css:
--------------------------------------------------------------------------------
1 | @tailwind base;
2 | @tailwind components;
3 | @tailwind utilities;
4 |
--------------------------------------------------------------------------------
/backend/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | # Keep environment variables out of version control
3 | .env
4 |
--------------------------------------------------------------------------------
/backend/.env.example:
--------------------------------------------------------------------------------
1 | APP_PORT=5000
2 | DATABASE_URL="mysql://root:123456@localhost:3306/prisma-react"
3 |
--------------------------------------------------------------------------------
/frontend/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/frontend/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/faisalfjri/crud-prisma-express-react/HEAD/frontend/public/favicon.ico
--------------------------------------------------------------------------------
/frontend/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/faisalfjri/crud-prisma-express-react/HEAD/frontend/public/logo192.png
--------------------------------------------------------------------------------
/frontend/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/faisalfjri/crud-prisma-express-react/HEAD/frontend/public/logo512.png
--------------------------------------------------------------------------------
/frontend/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | }
7 |
--------------------------------------------------------------------------------
/backend/prisma/migrations/migration_lock.toml:
--------------------------------------------------------------------------------
1 | # Please do not edit this file manually
2 | # It should be added in your version-control system (i.e. Git)
3 | provider = "mysql"
--------------------------------------------------------------------------------
/backend/jsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "baseUrl": ".",
4 | "module": "commonjs",
5 | "target": "es6"
6 | },
7 | "exclude": ["node_modules"]
8 | }
9 |
--------------------------------------------------------------------------------
/frontend/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM node:lts-alpine
2 |
3 | WORKDIR /usr/src/app
4 |
5 | COPY package*.json ./
6 |
7 | RUN npm install
8 |
9 | COPY . .
10 |
11 | EXPOSE 3001
12 |
13 | CMD ["node", "server.js"]
--------------------------------------------------------------------------------
/.prettierrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "printWidth": 160,
3 | "singleQuote": true,
4 | "tabWidth": 4,
5 | "arrowParens": "avoid",
6 | "jsxBracketSameLine": true,
7 | "semi": false,
8 | "trailingComma": "all"
9 | }
10 |
--------------------------------------------------------------------------------
/frontend/tailwind.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('tailwindcss').Config} */
2 | module.exports = {
3 | content: ['./src/**/*.{js,jsx,ts,tsx}'],
4 | theme: {
5 | container: {
6 | center: true,
7 | },
8 | extend: {},
9 | },
10 | plugins: [],
11 | }
12 |
--------------------------------------------------------------------------------
/frontend/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import ReactDOM from 'react-dom/client'
3 | import './index.css'
4 | import App from './App'
5 |
6 | const root = ReactDOM.createRoot(document.getElementById('root'))
7 | root.render(
8 |
9 |
10 | ,
11 | )
12 |
--------------------------------------------------------------------------------
/backend/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM node:lts-alpine
2 |
3 | RUN apk add --update --no-cache openssl1.1-compat
4 |
5 | WORKDIR /usr/src/app
6 |
7 | COPY package*.json ./
8 | COPY prisma ./prisma/
9 | COPY .env ./
10 | COPY jsconfig.json ./
11 |
12 | RUN npm install
13 |
14 | COPY . .
15 |
16 | RUN npx prisma generate
17 |
18 | EXPOSE 5000
19 |
20 | CMD npm start
--------------------------------------------------------------------------------
/backend/prisma/migrations/20221209073755_1/migration.sql:
--------------------------------------------------------------------------------
1 | -- CreateTable
2 | CREATE TABLE `product` (
3 | `id` INTEGER NOT NULL AUTO_INCREMENT,
4 | `name` VARCHAR(191) NOT NULL,
5 | `price` INTEGER NOT NULL,
6 | `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
7 |
8 | PRIMARY KEY (`id`)
9 | ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
10 |
--------------------------------------------------------------------------------
/frontend/server.js:
--------------------------------------------------------------------------------
1 | const express = require('express')
2 | const path = require('path')
3 | const app = express()
4 | const port = 3001
5 |
6 | app.use(express.static(path.join(__dirname, 'build')))
7 |
8 | app.get('/*', function (req, res) {
9 | res.sendFile(path.join(__dirname, 'build', 'index.html'))
10 | })
11 |
12 | app.listen(port, () => {
13 | console.log(`The app listening on port ${port}`)
14 | })
--------------------------------------------------------------------------------
/frontend/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/backend/prisma/schema.prisma:
--------------------------------------------------------------------------------
1 | // This is your Prisma schema file,
2 | // learn more about it in the docs: https://pris.ly/d/prisma-schema
3 |
4 | generator client {
5 | provider = "prisma-client-js"
6 | }
7 |
8 | datasource db {
9 | provider = "mysql"
10 | url = env("DATABASE_URL")
11 | }
12 |
13 | model product {
14 | id Int @id @default(autoincrement())
15 | name String
16 | price Int
17 | createdAt DateTime @default(now())
18 | }
19 |
--------------------------------------------------------------------------------
/backend/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.9'
2 |
3 | services:
4 | prisma-react:
5 | stdin_open: true
6 | build:
7 | context: .
8 | dockerfile: Dockerfile
9 | container_name: prisma-react
10 | ports:
11 | - 5000:5000
12 | restart: always
13 | networks:
14 | - shared_network
15 |
16 | networks:
17 | shared_network:
18 | driver: bridge
19 | name: shared_network
20 |
--------------------------------------------------------------------------------
/frontend/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.9'
2 |
3 | services:
4 | prisma-react-frontend:
5 | stdin_open: true
6 | build:
7 | context: .
8 | dockerfile: Dockerfile
9 | container_name: prisma-react-frontend
10 | ports:
11 | - 3001:3001
12 | restart: always
13 | networks:
14 | - shared_network
15 |
16 | networks:
17 | shared_network:
18 | driver: bridge
19 | name: shared_network
20 |
--------------------------------------------------------------------------------
/backend/routes/ProductRoute.js:
--------------------------------------------------------------------------------
1 | import express from 'express'
2 | import { getProducts, getProductById, createProduct, updateProduct, deleteProduct } from '../controller/ProductController.js'
3 |
4 | const router = express.Router()
5 |
6 | router.get('/products', getProducts)
7 | router.get('/products/:id', getProductById)
8 | router.post('/products', createProduct)
9 | router.patch('/products/:id', updateProduct)
10 | router.delete('/products/:id', deleteProduct)
11 |
12 | export default router
13 |
--------------------------------------------------------------------------------
/backend/index.js:
--------------------------------------------------------------------------------
1 | import express from 'express'
2 | import cors from 'cors'
3 | import dotenv from 'dotenv'
4 | import ProductRoute from './routes/ProductRoute.js'
5 | dotenv.config()
6 |
7 | const app = express()
8 | const port = process.env.APP_PORT || 5000
9 |
10 | app.use(cors())
11 | app.use(express.json())
12 | app.get('/', (req, res) => {
13 | res.send('Hello World!')
14 | })
15 | app.use(ProductRoute)
16 |
17 | app.listen(port, () => {
18 | console.log(`Server listening on port ${port}`)
19 | })
20 |
21 | export default app
22 |
--------------------------------------------------------------------------------
/backend/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "crud-express-prisma",
3 | "version": "1.0.0",
4 | "description": "CRUD Express Prisma - Backend",
5 | "type": "module",
6 | "main": "index.js",
7 | "scripts": {
8 | "dev": "nodemon index",
9 | "start": "node index.js"
10 | },
11 | "author": "Faisal Fajri",
12 | "license": "ISC",
13 | "dependencies": {
14 | "@prisma/client": "^4.7.1",
15 | "cors": "^2.8.5",
16 | "dotenv": "^16.0.3",
17 | "express": "^4.18.2",
18 | "prisma": "^4.7.1"
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/backend/request.rest:
--------------------------------------------------------------------------------
1 | ### HomePage
2 | GET http://localhost:5000
3 |
4 | ### Get Product All
5 | GET http://localhost:5000/products
6 |
7 | ### Show Product
8 | GET http://localhost:5000/products/1
9 |
10 | ### Create Product
11 | POST http://localhost:5000/products
12 | Content-Type: application/json
13 |
14 | {
15 | "name": "Milo",
16 | "price": 6000
17 | }
18 |
19 | ### Update Product
20 | PATCH http://localhost:5000/products/7
21 | Content-Type: application/json
22 |
23 | {
24 | "name": "Nutrisari",
25 | "price": 5000
26 | }
27 |
28 | ### Delete Product
29 | DELETE http://localhost:5000/products/1
--------------------------------------------------------------------------------
/frontend/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/frontend/src/App.js:
--------------------------------------------------------------------------------
1 | import { BrowserRouter, Routes, Route } from 'react-router-dom'
2 | import AddProduct from './components/AddProduct'
3 | import EditProduct from './components/EditProduct'
4 | import ProductList from './components/ProductList'
5 |
6 | export default function App() {
7 | return (
8 |
9 |
10 |
11 | }>
12 | }>
13 | }>
14 |
15 |
16 |
17 | )
18 | }
19 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Faisal Fajri
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Full-stack CRUD with Prisma, Express and React
2 |
3 | This project is a full-stack CRUD (create, read, update, delete) application using [Prisma](https://www.prisma.io/), [Express](https://expressjs.com), and [React](https://reactjs.org)
4 |
5 | ## Back-End
6 |
7 | ```bash
8 | cd backend
9 | ```
10 |
11 | copy the `.env.example` file to `.env`
12 |
13 | ```
14 | APP_PORT=5000
15 | DATABASE_URL="mysql://root:123456@localhost:3306/prisma-react"
16 | ```
17 |
18 | Install dependencies
19 |
20 | ```bash
21 | npm install
22 | ```
23 |
24 | Generate the Prisma Client
25 |
26 | ```
27 | npx prisma generate
28 | ```
29 |
30 | Migrate Database with Prisma
31 |
32 | ```
33 | npx prisma migrate dev
34 | ```
35 |
36 | Start the server
37 |
38 | ```bash
39 | npm start
40 | ```
41 |
42 | Your express server will now be running on port 5000. You can visit [http://localhost:5000](http://localhost:5000) in your web browser to verify that the server is working correctly.
43 |
44 | ## Front-End
45 |
46 | ```bash
47 | cd frontend
48 |
49 | # Install dependencies...
50 | npm install
51 |
52 | # To start the application...
53 | npm start
54 | ```
55 |
56 | Runs the app in the development mode. Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
57 |
--------------------------------------------------------------------------------
/frontend/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "crud-prisma-react",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@testing-library/jest-dom": "^5.16.5",
7 | "@testing-library/react": "^13.4.0",
8 | "@testing-library/user-event": "^13.5.0",
9 | "axios": "^1.2.1",
10 | "react": "^18.2.0",
11 | "react-dom": "^18.2.0",
12 | "react-router-dom": "^6.4.5",
13 | "react-scripts": "5.0.1",
14 | "swr": "^1.3.0",
15 | "web-vitals": "^2.1.4"
16 | },
17 | "scripts": {
18 | "start": "react-scripts start",
19 | "build": "react-scripts build",
20 | "test": "react-scripts test",
21 | "eject": "react-scripts eject"
22 | },
23 | "eslintConfig": {
24 | "extends": [
25 | "react-app",
26 | "react-app/jest"
27 | ]
28 | },
29 | "browserslist": {
30 | "production": [
31 | ">0.2%",
32 | "not dead",
33 | "not op_mini all"
34 | ],
35 | "development": [
36 | "last 1 chrome version",
37 | "last 1 firefox version",
38 | "last 1 safari version"
39 | ]
40 | },
41 | "devDependencies": {
42 | "autoprefixer": "^10.4.13",
43 | "postcss": "^8.4.19",
44 | "tailwindcss": "^3.2.4"
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/frontend/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
12 |
13 |
17 |
18 |
27 | React App
28 |
29 |
30 | You need to enable JavaScript to run this app.
31 |
32 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/backend/controller/ProductController.js:
--------------------------------------------------------------------------------
1 | import { PrismaClient } from '@prisma/client'
2 | const prisma = new PrismaClient()
3 |
4 | export const getProducts = async (req, res) => {
5 | try {
6 | const response = await prisma.product.findMany()
7 | res.status(200).json(response)
8 | } catch (error) {
9 | res.status(500).json({ msg: error.message })
10 | }
11 | }
12 |
13 | export const getProductById = async (req, res) => {
14 | try {
15 | const response = await prisma.product.findUnique({
16 | where: {
17 | id: Number(req.params.id),
18 | },
19 | })
20 | res.status(200).json(response)
21 | } catch (error) {
22 | res.status(404).json({ msg: error.message })
23 | }
24 | }
25 |
26 | export const createProduct = async (req, res) => {
27 | const { name, price } = req.body
28 | try {
29 | const product = await prisma.product.create({
30 | data: {
31 | name: name,
32 | price: price,
33 | },
34 | })
35 | res.status(201).json(product)
36 | } catch (error) {
37 | res.status(400).json({ msg: error.message })
38 | }
39 | }
40 |
41 | export const updateProduct = async (req, res) => {
42 | const { name, price } = req.body
43 | try {
44 | const product = await prisma.product.update({
45 | where: {
46 | id: Number(req.params.id),
47 | },
48 | data: {
49 | name: name,
50 | price: price,
51 | },
52 | })
53 | res.status(200).json(product)
54 | } catch (error) {
55 | res.status(400).json({ msg: error.message })
56 | }
57 | }
58 |
59 | export const deleteProduct = async (req, res) => {
60 | try {
61 | const product = await prisma.product.delete({
62 | where: {
63 | id: Number(req.params.id),
64 | },
65 | })
66 | res.status(200).json(product)
67 | } catch (error) {
68 | res.status(400).json({ msg: error.message })
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/frontend/src/components/AddProduct.jsx:
--------------------------------------------------------------------------------
1 | import axios from 'axios'
2 | import React, { useState } from 'react'
3 | import { Link, useNavigate } from 'react-router-dom'
4 |
5 | const AddProduct = () => {
6 | const [name, setName] = useState('')
7 | const [price, setPrice] = useState('')
8 | const navigate = useNavigate()
9 |
10 | const saveProduct = async e => {
11 | e.preventDefault()
12 | await axios.post('http://localhost:5000/products', { name: name, price: parseInt(price) })
13 | navigate('/')
14 | }
15 |
16 | return (
17 |
61 | )
62 | }
63 |
64 | export default AddProduct
65 |
--------------------------------------------------------------------------------
/frontend/README.md:
--------------------------------------------------------------------------------
1 | # Getting Started with Create React App
2 |
3 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
4 |
5 | ## Available Scripts
6 |
7 | In the project directory, you can run:
8 |
9 | ### `npm start`
10 |
11 | Runs the app in the development mode.\
12 | Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
13 |
14 | The page will reload when you make changes.\
15 | You may also see any lint errors in the console.
16 |
17 | ### `npm test`
18 |
19 | Launches the test runner in the interactive watch mode.\
20 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
21 |
22 | ### `npm run build`
23 |
24 | Builds the app for production to the `build` folder.\
25 | It correctly bundles React in production mode and optimizes the build for the best performance.
26 |
27 | The build is minified and the filenames include the hashes.\
28 | Your app is ready to be deployed!
29 |
30 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
31 |
32 | ### `npm run eject`
33 |
34 | **Note: this is a one-way operation. Once you `eject`, you can't go back!**
35 |
36 | If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
37 |
38 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
39 |
40 | You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
41 |
42 | ## Learn More
43 |
44 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
45 |
46 | To learn React, check out the [React documentation](https://reactjs.org/).
47 |
48 | ### Code Splitting
49 |
50 | This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
51 |
52 | ### Analyzing the Bundle Size
53 |
54 | This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
55 |
56 | ### Making a Progressive Web App
57 |
58 | This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
59 |
60 | ### Advanced Configuration
61 |
62 | This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
63 |
64 | ### Deployment
65 |
66 | This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
67 |
68 | ### `npm run build` fails to minify
69 |
70 | This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
71 |
--------------------------------------------------------------------------------
/frontend/src/components/EditProduct.jsx:
--------------------------------------------------------------------------------
1 | import axios from 'axios'
2 | import React, { useEffect, useState } from 'react'
3 | import { Link, useNavigate, useParams } from 'react-router-dom'
4 |
5 | const EditProduct = () => {
6 | const [name, setName] = useState('')
7 | const [price, setPrice] = useState('')
8 | const navigate = useNavigate()
9 | const { id } = useParams()
10 |
11 | useEffect(() => {
12 | const getProductById = async () => {
13 | const response = await axios.get(`http://localhost:5000/products/${id}`)
14 | setName(response.data.name)
15 | setPrice(response.data.price)
16 | }
17 | getProductById()
18 | }, [id])
19 |
20 | const updateProduct = async e => {
21 | e.preventDefault()
22 | await axios.patch(`http://localhost:5000/products/${id}`, { name: name, price: parseInt(price) })
23 | navigate('/')
24 | }
25 |
26 | return (
27 |
71 | )
72 | }
73 |
74 | export default EditProduct
75 |
--------------------------------------------------------------------------------
/frontend/src/components/ProductList.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { Link } from 'react-router-dom'
3 | import axios from 'axios'
4 | import useSWR, { mutate } from 'swr'
5 |
6 | const ProductList = () => {
7 | const fetcher = async () => {
8 | const response = await axios.get('http://localhost:5000/products')
9 | return response.data
10 | }
11 |
12 | const { data } = useSWR('products', fetcher)
13 | if (!data) {
14 | return Loading...
15 | }
16 |
17 | const deleteProduct = async productId => {
18 | await axios.delete(`http://localhost:5000/products/${productId}`)
19 | mutate('products')
20 | }
21 |
22 | return (
23 |
24 |
25 |
26 |
29 | Add New Product
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 | #
38 |
39 |
40 | Product name
41 |
42 |
43 | Price
44 |
45 |
46 | Action
47 |
48 |
49 |
50 |
51 | {data.length !== 0 ? (
52 | data.map((product, index) => (
53 |
54 | {index + 1}
55 |
56 | {product.name}
57 |
58 | {product.price}
59 |
60 |
61 |
64 | Edit
65 |
66 |
67 | deleteProduct(product.id)}
70 | className="py-2 px-3 text-sm font-medium ocus:outline-none text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:ring-red-300 rounded-lg mr-2 mb-2 dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-900">
71 | Delete
72 |
73 |
74 |
75 | ))
76 | ) : (
77 |
78 |
79 | Tidak Ada Data
80 |
81 |
82 | )}
83 |
84 |
85 |
86 |
87 |
88 | )
89 | }
90 |
91 | export default ProductList
92 |
--------------------------------------------------------------------------------
/backend/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "backend",
3 | "version": "1.0.0",
4 | "lockfileVersion": 3,
5 | "requires": true,
6 | "packages": {
7 | "": {
8 | "name": "backend",
9 | "version": "1.0.0",
10 | "license": "ISC",
11 | "dependencies": {
12 | "@prisma/client": "^4.7.1",
13 | "cors": "^2.8.5",
14 | "dotenv": "^16.0.3",
15 | "express": "^4.18.2"
16 | },
17 | "devDependencies": {
18 | "prisma": "^4.7.1"
19 | }
20 | },
21 | "node_modules/@prisma/client": {
22 | "version": "4.7.1",
23 | "resolved": "https://registry.npmjs.org/@prisma/client/-/client-4.7.1.tgz",
24 | "integrity": "sha512-/GbnOwIPtjiveZNUzGXOdp7RxTEkHL4DZP3vBaFNadfr6Sf0RshU5EULFzVaSi9i9PIK9PYd+1Rn7z2B2npb9w==",
25 | "hasInstallScript": true,
26 | "dependencies": {
27 | "@prisma/engines-version": "4.7.1-1.272861e07ab64f234d3ffc4094e32bd61775599c"
28 | },
29 | "engines": {
30 | "node": ">=14.17"
31 | },
32 | "peerDependencies": {
33 | "prisma": "*"
34 | },
35 | "peerDependenciesMeta": {
36 | "prisma": {
37 | "optional": true
38 | }
39 | }
40 | },
41 | "node_modules/@prisma/engines": {
42 | "version": "4.7.1",
43 | "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-4.7.1.tgz",
44 | "integrity": "sha512-zWabHosTdLpXXlMefHmnouhXMoTB1+SCbUU3t4FCmdrtIOZcarPKU3Alto7gm/pZ9vHlGOXHCfVZ1G7OIrSbog==",
45 | "devOptional": true,
46 | "hasInstallScript": true
47 | },
48 | "node_modules/@prisma/engines-version": {
49 | "version": "4.7.1-1.272861e07ab64f234d3ffc4094e32bd61775599c",
50 | "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-4.7.1-1.272861e07ab64f234d3ffc4094e32bd61775599c.tgz",
51 | "integrity": "sha512-Bd4LZ+WAnUHOq31e9X/ihi5zPlr4SzTRwUZZYxvWOxlerIZ7HJlVa9zXpuKTKLpI9O1l8Ec4OYCKsivWCs5a3Q=="
52 | },
53 | "node_modules/accepts": {
54 | "version": "1.3.8",
55 | "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
56 | "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
57 | "dependencies": {
58 | "mime-types": "~2.1.34",
59 | "negotiator": "0.6.3"
60 | },
61 | "engines": {
62 | "node": ">= 0.6"
63 | }
64 | },
65 | "node_modules/array-flatten": {
66 | "version": "1.1.1",
67 | "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
68 | "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg=="
69 | },
70 | "node_modules/body-parser": {
71 | "version": "1.20.1",
72 | "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz",
73 | "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==",
74 | "dependencies": {
75 | "bytes": "3.1.2",
76 | "content-type": "~1.0.4",
77 | "debug": "2.6.9",
78 | "depd": "2.0.0",
79 | "destroy": "1.2.0",
80 | "http-errors": "2.0.0",
81 | "iconv-lite": "0.4.24",
82 | "on-finished": "2.4.1",
83 | "qs": "6.11.0",
84 | "raw-body": "2.5.1",
85 | "type-is": "~1.6.18",
86 | "unpipe": "1.0.0"
87 | },
88 | "engines": {
89 | "node": ">= 0.8",
90 | "npm": "1.2.8000 || >= 1.4.16"
91 | }
92 | },
93 | "node_modules/bytes": {
94 | "version": "3.1.2",
95 | "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
96 | "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
97 | "engines": {
98 | "node": ">= 0.8"
99 | }
100 | },
101 | "node_modules/call-bind": {
102 | "version": "1.0.2",
103 | "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
104 | "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==",
105 | "dependencies": {
106 | "function-bind": "^1.1.1",
107 | "get-intrinsic": "^1.0.2"
108 | },
109 | "funding": {
110 | "url": "https://github.com/sponsors/ljharb"
111 | }
112 | },
113 | "node_modules/content-disposition": {
114 | "version": "0.5.4",
115 | "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
116 | "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==",
117 | "dependencies": {
118 | "safe-buffer": "5.2.1"
119 | },
120 | "engines": {
121 | "node": ">= 0.6"
122 | }
123 | },
124 | "node_modules/content-type": {
125 | "version": "1.0.4",
126 | "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz",
127 | "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==",
128 | "engines": {
129 | "node": ">= 0.6"
130 | }
131 | },
132 | "node_modules/cookie": {
133 | "version": "0.5.0",
134 | "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz",
135 | "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==",
136 | "engines": {
137 | "node": ">= 0.6"
138 | }
139 | },
140 | "node_modules/cookie-signature": {
141 | "version": "1.0.6",
142 | "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
143 | "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ=="
144 | },
145 | "node_modules/cors": {
146 | "version": "2.8.5",
147 | "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
148 | "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
149 | "dependencies": {
150 | "object-assign": "^4",
151 | "vary": "^1"
152 | },
153 | "engines": {
154 | "node": ">= 0.10"
155 | }
156 | },
157 | "node_modules/debug": {
158 | "version": "2.6.9",
159 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
160 | "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
161 | "dependencies": {
162 | "ms": "2.0.0"
163 | }
164 | },
165 | "node_modules/depd": {
166 | "version": "2.0.0",
167 | "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
168 | "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
169 | "engines": {
170 | "node": ">= 0.8"
171 | }
172 | },
173 | "node_modules/destroy": {
174 | "version": "1.2.0",
175 | "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
176 | "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",
177 | "engines": {
178 | "node": ">= 0.8",
179 | "npm": "1.2.8000 || >= 1.4.16"
180 | }
181 | },
182 | "node_modules/dotenv": {
183 | "version": "16.0.3",
184 | "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz",
185 | "integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==",
186 | "engines": {
187 | "node": ">=12"
188 | }
189 | },
190 | "node_modules/ee-first": {
191 | "version": "1.1.1",
192 | "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
193 | "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="
194 | },
195 | "node_modules/encodeurl": {
196 | "version": "1.0.2",
197 | "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
198 | "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==",
199 | "engines": {
200 | "node": ">= 0.8"
201 | }
202 | },
203 | "node_modules/escape-html": {
204 | "version": "1.0.3",
205 | "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
206 | "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow=="
207 | },
208 | "node_modules/etag": {
209 | "version": "1.8.1",
210 | "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
211 | "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
212 | "engines": {
213 | "node": ">= 0.6"
214 | }
215 | },
216 | "node_modules/express": {
217 | "version": "4.18.2",
218 | "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz",
219 | "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==",
220 | "dependencies": {
221 | "accepts": "~1.3.8",
222 | "array-flatten": "1.1.1",
223 | "body-parser": "1.20.1",
224 | "content-disposition": "0.5.4",
225 | "content-type": "~1.0.4",
226 | "cookie": "0.5.0",
227 | "cookie-signature": "1.0.6",
228 | "debug": "2.6.9",
229 | "depd": "2.0.0",
230 | "encodeurl": "~1.0.2",
231 | "escape-html": "~1.0.3",
232 | "etag": "~1.8.1",
233 | "finalhandler": "1.2.0",
234 | "fresh": "0.5.2",
235 | "http-errors": "2.0.0",
236 | "merge-descriptors": "1.0.1",
237 | "methods": "~1.1.2",
238 | "on-finished": "2.4.1",
239 | "parseurl": "~1.3.3",
240 | "path-to-regexp": "0.1.7",
241 | "proxy-addr": "~2.0.7",
242 | "qs": "6.11.0",
243 | "range-parser": "~1.2.1",
244 | "safe-buffer": "5.2.1",
245 | "send": "0.18.0",
246 | "serve-static": "1.15.0",
247 | "setprototypeof": "1.2.0",
248 | "statuses": "2.0.1",
249 | "type-is": "~1.6.18",
250 | "utils-merge": "1.0.1",
251 | "vary": "~1.1.2"
252 | },
253 | "engines": {
254 | "node": ">= 0.10.0"
255 | }
256 | },
257 | "node_modules/finalhandler": {
258 | "version": "1.2.0",
259 | "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz",
260 | "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==",
261 | "dependencies": {
262 | "debug": "2.6.9",
263 | "encodeurl": "~1.0.2",
264 | "escape-html": "~1.0.3",
265 | "on-finished": "2.4.1",
266 | "parseurl": "~1.3.3",
267 | "statuses": "2.0.1",
268 | "unpipe": "~1.0.0"
269 | },
270 | "engines": {
271 | "node": ">= 0.8"
272 | }
273 | },
274 | "node_modules/forwarded": {
275 | "version": "0.2.0",
276 | "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
277 | "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
278 | "engines": {
279 | "node": ">= 0.6"
280 | }
281 | },
282 | "node_modules/fresh": {
283 | "version": "0.5.2",
284 | "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
285 | "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",
286 | "engines": {
287 | "node": ">= 0.6"
288 | }
289 | },
290 | "node_modules/function-bind": {
291 | "version": "1.1.1",
292 | "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
293 | "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
294 | },
295 | "node_modules/get-intrinsic": {
296 | "version": "1.1.3",
297 | "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz",
298 | "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==",
299 | "dependencies": {
300 | "function-bind": "^1.1.1",
301 | "has": "^1.0.3",
302 | "has-symbols": "^1.0.3"
303 | },
304 | "funding": {
305 | "url": "https://github.com/sponsors/ljharb"
306 | }
307 | },
308 | "node_modules/has": {
309 | "version": "1.0.3",
310 | "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
311 | "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
312 | "dependencies": {
313 | "function-bind": "^1.1.1"
314 | },
315 | "engines": {
316 | "node": ">= 0.4.0"
317 | }
318 | },
319 | "node_modules/has-symbols": {
320 | "version": "1.0.3",
321 | "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
322 | "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==",
323 | "engines": {
324 | "node": ">= 0.4"
325 | },
326 | "funding": {
327 | "url": "https://github.com/sponsors/ljharb"
328 | }
329 | },
330 | "node_modules/http-errors": {
331 | "version": "2.0.0",
332 | "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
333 | "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==",
334 | "dependencies": {
335 | "depd": "2.0.0",
336 | "inherits": "2.0.4",
337 | "setprototypeof": "1.2.0",
338 | "statuses": "2.0.1",
339 | "toidentifier": "1.0.1"
340 | },
341 | "engines": {
342 | "node": ">= 0.8"
343 | }
344 | },
345 | "node_modules/iconv-lite": {
346 | "version": "0.4.24",
347 | "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
348 | "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
349 | "dependencies": {
350 | "safer-buffer": ">= 2.1.2 < 3"
351 | },
352 | "engines": {
353 | "node": ">=0.10.0"
354 | }
355 | },
356 | "node_modules/inherits": {
357 | "version": "2.0.4",
358 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
359 | "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
360 | },
361 | "node_modules/ipaddr.js": {
362 | "version": "1.9.1",
363 | "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
364 | "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
365 | "engines": {
366 | "node": ">= 0.10"
367 | }
368 | },
369 | "node_modules/media-typer": {
370 | "version": "0.3.0",
371 | "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
372 | "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==",
373 | "engines": {
374 | "node": ">= 0.6"
375 | }
376 | },
377 | "node_modules/merge-descriptors": {
378 | "version": "1.0.1",
379 | "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
380 | "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w=="
381 | },
382 | "node_modules/methods": {
383 | "version": "1.1.2",
384 | "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
385 | "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==",
386 | "engines": {
387 | "node": ">= 0.6"
388 | }
389 | },
390 | "node_modules/mime": {
391 | "version": "1.6.0",
392 | "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
393 | "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
394 | "bin": {
395 | "mime": "cli.js"
396 | },
397 | "engines": {
398 | "node": ">=4"
399 | }
400 | },
401 | "node_modules/mime-db": {
402 | "version": "1.52.0",
403 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
404 | "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
405 | "engines": {
406 | "node": ">= 0.6"
407 | }
408 | },
409 | "node_modules/mime-types": {
410 | "version": "2.1.35",
411 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
412 | "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
413 | "dependencies": {
414 | "mime-db": "1.52.0"
415 | },
416 | "engines": {
417 | "node": ">= 0.6"
418 | }
419 | },
420 | "node_modules/ms": {
421 | "version": "2.0.0",
422 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
423 | "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="
424 | },
425 | "node_modules/negotiator": {
426 | "version": "0.6.3",
427 | "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
428 | "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
429 | "engines": {
430 | "node": ">= 0.6"
431 | }
432 | },
433 | "node_modules/object-assign": {
434 | "version": "4.1.1",
435 | "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
436 | "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
437 | "engines": {
438 | "node": ">=0.10.0"
439 | }
440 | },
441 | "node_modules/object-inspect": {
442 | "version": "1.12.2",
443 | "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz",
444 | "integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==",
445 | "funding": {
446 | "url": "https://github.com/sponsors/ljharb"
447 | }
448 | },
449 | "node_modules/on-finished": {
450 | "version": "2.4.1",
451 | "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
452 | "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
453 | "dependencies": {
454 | "ee-first": "1.1.1"
455 | },
456 | "engines": {
457 | "node": ">= 0.8"
458 | }
459 | },
460 | "node_modules/parseurl": {
461 | "version": "1.3.3",
462 | "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
463 | "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
464 | "engines": {
465 | "node": ">= 0.8"
466 | }
467 | },
468 | "node_modules/path-to-regexp": {
469 | "version": "0.1.7",
470 | "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
471 | "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ=="
472 | },
473 | "node_modules/prisma": {
474 | "version": "4.7.1",
475 | "resolved": "https://registry.npmjs.org/prisma/-/prisma-4.7.1.tgz",
476 | "integrity": "sha512-CCQP+m+1qZOGIZlvnL6T3ZwaU0LAleIHYFPN9tFSzjs/KL6vH9rlYbGOkTuG9Q1s6Ki5D0LJlYlW18Z9EBUpGg==",
477 | "devOptional": true,
478 | "hasInstallScript": true,
479 | "dependencies": {
480 | "@prisma/engines": "4.7.1"
481 | },
482 | "bin": {
483 | "prisma": "build/index.js",
484 | "prisma2": "build/index.js"
485 | },
486 | "engines": {
487 | "node": ">=14.17"
488 | }
489 | },
490 | "node_modules/proxy-addr": {
491 | "version": "2.0.7",
492 | "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
493 | "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
494 | "dependencies": {
495 | "forwarded": "0.2.0",
496 | "ipaddr.js": "1.9.1"
497 | },
498 | "engines": {
499 | "node": ">= 0.10"
500 | }
501 | },
502 | "node_modules/qs": {
503 | "version": "6.11.0",
504 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
505 | "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==",
506 | "dependencies": {
507 | "side-channel": "^1.0.4"
508 | },
509 | "engines": {
510 | "node": ">=0.6"
511 | },
512 | "funding": {
513 | "url": "https://github.com/sponsors/ljharb"
514 | }
515 | },
516 | "node_modules/range-parser": {
517 | "version": "1.2.1",
518 | "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
519 | "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
520 | "engines": {
521 | "node": ">= 0.6"
522 | }
523 | },
524 | "node_modules/raw-body": {
525 | "version": "2.5.1",
526 | "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz",
527 | "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==",
528 | "dependencies": {
529 | "bytes": "3.1.2",
530 | "http-errors": "2.0.0",
531 | "iconv-lite": "0.4.24",
532 | "unpipe": "1.0.0"
533 | },
534 | "engines": {
535 | "node": ">= 0.8"
536 | }
537 | },
538 | "node_modules/safe-buffer": {
539 | "version": "5.2.1",
540 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
541 | "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
542 | "funding": [
543 | {
544 | "type": "github",
545 | "url": "https://github.com/sponsors/feross"
546 | },
547 | {
548 | "type": "patreon",
549 | "url": "https://www.patreon.com/feross"
550 | },
551 | {
552 | "type": "consulting",
553 | "url": "https://feross.org/support"
554 | }
555 | ]
556 | },
557 | "node_modules/safer-buffer": {
558 | "version": "2.1.2",
559 | "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
560 | "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
561 | },
562 | "node_modules/send": {
563 | "version": "0.18.0",
564 | "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz",
565 | "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==",
566 | "dependencies": {
567 | "debug": "2.6.9",
568 | "depd": "2.0.0",
569 | "destroy": "1.2.0",
570 | "encodeurl": "~1.0.2",
571 | "escape-html": "~1.0.3",
572 | "etag": "~1.8.1",
573 | "fresh": "0.5.2",
574 | "http-errors": "2.0.0",
575 | "mime": "1.6.0",
576 | "ms": "2.1.3",
577 | "on-finished": "2.4.1",
578 | "range-parser": "~1.2.1",
579 | "statuses": "2.0.1"
580 | },
581 | "engines": {
582 | "node": ">= 0.8.0"
583 | }
584 | },
585 | "node_modules/send/node_modules/ms": {
586 | "version": "2.1.3",
587 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
588 | "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
589 | },
590 | "node_modules/serve-static": {
591 | "version": "1.15.0",
592 | "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz",
593 | "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==",
594 | "dependencies": {
595 | "encodeurl": "~1.0.2",
596 | "escape-html": "~1.0.3",
597 | "parseurl": "~1.3.3",
598 | "send": "0.18.0"
599 | },
600 | "engines": {
601 | "node": ">= 0.8.0"
602 | }
603 | },
604 | "node_modules/setprototypeof": {
605 | "version": "1.2.0",
606 | "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
607 | "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="
608 | },
609 | "node_modules/side-channel": {
610 | "version": "1.0.4",
611 | "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
612 | "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==",
613 | "dependencies": {
614 | "call-bind": "^1.0.0",
615 | "get-intrinsic": "^1.0.2",
616 | "object-inspect": "^1.9.0"
617 | },
618 | "funding": {
619 | "url": "https://github.com/sponsors/ljharb"
620 | }
621 | },
622 | "node_modules/statuses": {
623 | "version": "2.0.1",
624 | "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
625 | "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==",
626 | "engines": {
627 | "node": ">= 0.8"
628 | }
629 | },
630 | "node_modules/toidentifier": {
631 | "version": "1.0.1",
632 | "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
633 | "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
634 | "engines": {
635 | "node": ">=0.6"
636 | }
637 | },
638 | "node_modules/type-is": {
639 | "version": "1.6.18",
640 | "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
641 | "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
642 | "dependencies": {
643 | "media-typer": "0.3.0",
644 | "mime-types": "~2.1.24"
645 | },
646 | "engines": {
647 | "node": ">= 0.6"
648 | }
649 | },
650 | "node_modules/unpipe": {
651 | "version": "1.0.0",
652 | "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
653 | "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
654 | "engines": {
655 | "node": ">= 0.8"
656 | }
657 | },
658 | "node_modules/utils-merge": {
659 | "version": "1.0.1",
660 | "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
661 | "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",
662 | "engines": {
663 | "node": ">= 0.4.0"
664 | }
665 | },
666 | "node_modules/vary": {
667 | "version": "1.1.2",
668 | "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
669 | "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
670 | "engines": {
671 | "node": ">= 0.8"
672 | }
673 | }
674 | }
675 | }
676 |
--------------------------------------------------------------------------------