Next.js Discord

Discord Forum

hide fetch url

Answered
Atlantic mackerel posted this in #help-forum
Open in Discord
Atlantic mackerelOP
export interface User {
    nickname: String,
    email: String,
    password: String,
    ip: String,
    date: String
}

export async function postAuthorization(user: User) {
    await fetch(`http://ip:8000/user`, {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json',
        },
        body: JSON.stringify(user),
    });
}

Im writing this code, but I wonder how to hide that fetch's url?
(to prevent case like if user paste that code and request too many time)
Or, is there any way to check request? (via include API token, or etc )
Answered by Ray
if you fetch it on server side, the users shouldn't see it
View full answer

3 Replies