communication from client to nuxt server
This commit is contained in:
15
server/api/login.ts
Normal file
15
server/api/login.ts
Normal file
@ -0,0 +1,15 @@
|
||||
export default defineEventHandler(async (event) => {
|
||||
const body = await readBody(event)
|
||||
|
||||
if ((body.username == 'test') && (body.password == 'asd')) {
|
||||
setResponseStatus(event, 202)
|
||||
return {
|
||||
login: 'successful'
|
||||
}
|
||||
} else {
|
||||
throw createError({
|
||||
statusCode: 400,
|
||||
statusMessage: 'Login failed',
|
||||
})
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user