generated from corrad-software/corrad-af-2024
Figuring out REST functionality for Nuxt.js
This commit is contained in:
parent
52a080e69a
commit
822d5e3ca4
@ -7,8 +7,11 @@ export default defineEventHandler( async (event) => {
|
||||
|
||||
const successMsg = "Hello from the backend";
|
||||
|
||||
const folders = await prisma.cabinets.findMany();
|
||||
|
||||
return {
|
||||
status: 200,
|
||||
message: successMsg
|
||||
message: successMsg,
|
||||
folders: folders
|
||||
};
|
||||
});
|
24
server/api/dms/folder.post.js
Normal file
24
server/api/dms/folder.post.js
Normal file
@ -0,0 +1,24 @@
|
||||
import { PrismaClient } from "@prisma/client";
|
||||
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
export default defineEventHandler( async (event) => {
|
||||
console.log("This is a test for a POST request to the backend");
|
||||
|
||||
// const successMsg = "Hello from the backend";
|
||||
|
||||
const body = readBody(event);
|
||||
|
||||
if (!body) {
|
||||
return {
|
||||
status: 400,
|
||||
message: "Body was not received"
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
status: 200,
|
||||
message: "Body received successfully",
|
||||
body: body
|
||||
};
|
||||
}
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user