Is this ok to do on a server function?
Unanswered
Blue-throated Hummingbird posted this in #help-forum
![Avatar](https://cdn.discordapp.com/embed/avatars/3.png)
Blue-throated HummingbirdOP
Is the following okay to do on a server function, I am new to nextJS and I'm not entirely sure if I can fetch data like this on a server component
![Image](https://cdn.discordapp.com/attachments/1119866744467619911/1119866744622821397/image.png)
3 Replies
![Avatar](https://cdn.discordapp.com/avatars/484037068239142956/44415017de6fed2ccd5d44b4b2051ac0.webp?size=256)
joulev
Yes that is completely fine
![Avatar](https://cdn.discordapp.com/embed/avatars/3.png)
Blue-throated HummingbirdOP
Alright, so if I wanted to I could move all my API routes to server functions inside the components?
![Avatar](https://cdn.discordapp.com/avatars/484037068239142956/44415017de6fed2ccd5d44b4b2051ac0.webp?size=256)
joulev
That’s precisely what you should do to fetch data, yes