Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
project_ss23_gameunity
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Yusuf Akgül
project_ss23_gameunity
Merge requests
!3
Implement message schema
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Implement message schema
implementMessageSchema
into
main
Overview
0
Commits
4
Pipelines
2
Changes
12
Merged
David
requested to merge
implementMessageSchema
into
main
1 year ago
Overview
0
Commits
4
Pipelines
2
Changes
12
Expand
0
0
Merge request reports
Compare
main
version 1
b6abb261
1 year ago
main (base)
and
latest version
latest version
945af5b0
4 commits,
1 year ago
version 1
b6abb261
3 commits,
1 year ago
12 files
+
222
−
2
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
12
Search (e.g. *.vue) (Ctrl+P)
app/api/messages/route.ts
0 → 100644
+
56
−
0
Options
import
{
PrismaClient
}
from
"
@prisma/client
"
import
{
NextApiRequest
,
NextApiResponse
}
from
"
next
"
import
{
NextRequest
,
NextResponse
}
from
"
next/server
"
import
{
prisma
}
from
'
./../../../prisma/db
'
export
async
function
GET
(
req
:
NextRequest
){
return
NextResponse
.
json
(
""
)
}
export
async
function
POST
(
req
:
NextRequest
,
res
:
NextResponse
){
const
data
=
await
req
.
json
()
console
.
log
(
"
router data:
"
+
data
,
"
status:
"
)
console
.
log
(
data
)
try
{
await
prisma
.
message
.
create
({
data
:
data
})
return
NextResponse
.
json
({
status
:
201
,
message
:
'
Message Created
'
})
//res.status(200).json({message: 'Message Created'})
//res.status(200).json({message: 'Message Created'})
}
catch
(
error
)
{
console
.
log
(
"
Failure
"
+
error
);
// res.status(400)
}
console
.
log
(
"
post
"
)
}
/*
export default async function handler(req: NextApiRequest, res: NextApiResponse){
const data = (req.body)
try {
await prisma.message.create({
data
})
res.status(200).json({message: 'Note Created'})
} catch (error) {
console.log("Failure");
}
} */
/* export const postMessage = async(req: NextApiRequest , res: NextApiResponse) => {
const data = (req.body)
console.log("router data: " + data)
const createdMessage = await prisma.message.create({
data
})
res.status(201)
} */
\ No newline at end of file
Loading