account systeme
Unanswered
Checkered Giant posted this in #help-forum
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
Checkered GiantOP
Heyy! i need to create a login/register systeme in my nextjs project, i allready make some api test ect, but i got some truble about how i need to call my api, as exemple when someone register do i need to use a body in my api to put the info to the api or du i use a slug api url?
If someone can help me please, Thanks!
If someone can help me please, Thanks!
5 Replies
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
Checkered GiantOP
what is the best method and how to do it securely?
I haven't used api for a long time and I don't understand it all.
I haven't used api for a long time and I don't understand it all.
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Tonkinese
The test api you have created, what does it look like?
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
Checkered GiantOP
I create one using the slug api named [id].js and i want to know if that better to use the api req.body (when i try use req.body thats dont work) and my slug api test is :
import { NextApiRequest, NextApiResponse } from 'next'
import User from '../../../module/sequelize/model/User'
import { Sequelize } from 'sequelize'
export default async function handler(_req, res) {
const { id } = _req.query
try {
await User.findOne({
where: {
[Sequelize.Op.or]: [{ id: `${id}` }],
},
}).then(x=>{
if(x&&x.username){
res.end(`${x.username}`)
}else{
res.end(`can't find`)
}
})
} catch (error) {
// Handle any errors that occur during the request
res.end(`err : ${error}`)
}
}
@Tonkinese
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
Checkered GiantOP
So if someone know how to do please tell me!