mirror of
https://github.com/Floriansylvain/PopCorn.git
synced 2026-08-19 11:43:23 +02:00
Essaie de coudinary : échec
This commit is contained in:
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"liveServer.settings.port": 5501
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import express from "express";
|
import express from "express";
|
||||||
import { PrismaClient } from "@prisma/client";
|
import { PrismaClient } from "@prisma/client";
|
||||||
import createError from "http-errors"
|
import createError from "http-errors"
|
||||||
|
import cors from 'cors';
|
||||||
import jeux from './route/jeux.js'
|
import jeux from './route/jeux.js'
|
||||||
import groupe from './route/groupe.js'
|
import groupe from './route/groupe.js'
|
||||||
const app = express()
|
const app = express()
|
||||||
@@ -11,7 +11,11 @@ app.use(express.urlencoded({extended:true}))
|
|||||||
|
|
||||||
const port = 3500
|
const port = 3500
|
||||||
|
|
||||||
|
app.use(
|
||||||
|
cors({
|
||||||
|
origin: ["http://127.0.0.1:5500"],
|
||||||
|
})
|
||||||
|
);
|
||||||
app.use('/',jeux)
|
app.use('/',jeux)
|
||||||
app.use('/',groupe)
|
app.use('/',groupe)
|
||||||
|
|
||||||
|
|||||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 1.1 MiB |
Generated
+1551
File diff suppressed because it is too large
Load Diff
@@ -1,9 +1,12 @@
|
|||||||
{
|
{
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@prisma/client": "^4.9.0",
|
"@prisma/client": "^4.9.0",
|
||||||
|
"cloudinary": "^1.33.0",
|
||||||
|
"cors": "^2.8.5",
|
||||||
"express": "^4.18.2",
|
"express": "^4.18.2",
|
||||||
"http-errors": "^2.0.0",
|
"http-errors": "^2.0.0",
|
||||||
"https-error": "^1.0.2",
|
"https-error": "^1.0.2",
|
||||||
|
"multer": "^1.4.5-lts.1",
|
||||||
"nodemon": "^2.0.20",
|
"nodemon": "^2.0.20",
|
||||||
"prisma": "^4.9.0",
|
"prisma": "^4.9.0",
|
||||||
"zod": "^3.20.2"
|
"zod": "^3.20.2"
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ import express from "express";
|
|||||||
import { PrismaClient } from "@prisma/client";
|
import { PrismaClient } from "@prisma/client";
|
||||||
import createError from "http-errors"
|
import createError from "http-errors"
|
||||||
import groupeValidation from "../groupeValidator.js";
|
import groupeValidation from "../groupeValidator.js";
|
||||||
|
|
||||||
const router = express.Router()
|
const router = express.Router()
|
||||||
const prisma = new PrismaClient();
|
const prisma = new PrismaClient();
|
||||||
|
|
||||||
|
|||||||
+10
-1
@@ -2,12 +2,13 @@ import express from "express";
|
|||||||
import { PrismaClient } from "@prisma/client";
|
import { PrismaClient } from "@prisma/client";
|
||||||
import createError from "http-errors"
|
import createError from "http-errors"
|
||||||
import jeuxValidation from "../jeuxValidator.js";
|
import jeuxValidation from "../jeuxValidator.js";
|
||||||
|
|
||||||
const router = express.Router()
|
const router = express.Router()
|
||||||
const prisma = new PrismaClient();
|
const prisma = new PrismaClient();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
router.post('/jeux',async (req,res,next)=>{
|
router.post('/jeux',async (req,res,next)=>{
|
||||||
let jeuxData;
|
let jeuxData;
|
||||||
jeuxData = jeuxValidation.parse(req.body)
|
jeuxData = jeuxValidation.parse(req.body)
|
||||||
@@ -31,6 +32,14 @@ router.post('/jeux',async (req,res,next)=>{
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
router.get('/jeux', async(req,res)=>{
|
||||||
|
let jeux = await prisma.jeux.findMany({
|
||||||
|
include:{
|
||||||
|
groupe:true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
res.json(jeux)
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user