hide fetch url
Answered
Atlantic mackerel posted this in #help-forum
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 )
3 Replies
@Atlantic mackerel ts
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 )
if you fetch it on server side, the users shouldn't see it
Answer
if you are fetching it on client side, you can fetch it in a route handler
@Ray if you are fetching it on client side, you can fetch it in a route handler
Atlantic mackerelOP
Ah thank you