Can I use server actions to make post,put ,delete api call in server actions the apis are made in no
Answered
Northeast Congo Lion posted this in #help-forum
Northeast Congo LionOP
Can I use server actions to make post,put ,delete api call in server actions the apis are made in nodejs. for functionality like to add somethig to a list or update it
Answered by Ray
do you mean you want to make api call inside the server action?
yes, you can do that
yes, you can do that
export async function serverAction() {
const res = await fetch("", {
method: "POST" | "PUT" | "DELETE"
})
...
}5 Replies
Northeast Congo LionOP
&752637460550385834 can someone please answer this
do not ping moderators for code help
@joulev do not ping moderators for code help
Northeast Congo LionOP
was waiting for the last 2 days so gave it a try XD
@Northeast Congo Lion Can I use server actions to make post,put ,delete api call in server actions the apis are made in nodejs. for functionality like to add somethig to a list or update it
do you mean you want to make api call inside the server action?
yes, you can do that
yes, you can do that
export async function serverAction() {
const res = await fetch("", {
method: "POST" | "PUT" | "DELETE"
})
...
}Answer
Northeast Congo LionOP
ok Thankyou