#fetch
26 messages · Page 1 of 1 (latest)
🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord
🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize
✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)
// app/page.tsx
export default function Page() {
const res = await fetch("https://jsonplaceholder.typicode.com/todos/1")
const data = await res.json()
return <>{JSON.stringify(data,null,2)}</>
}
whenever you need the data to render?
what do you get?
im getting it now
what
on
earth
ig it worked then
i swear it wasne tbefore
i guess i was doing something that was wrong
ty
This question has been marked as answered! If you have any other questions, feel free to create another post
[Click here](#1183092170417246258 message)
the issue is with your api
alr
const express = require("express");
const next = require("next");
const cors = require('cors')
const port = 8080;
const dev = "production";
const app = next({ dev, dir: '../client' });
const handle = app.getRequestHandler();
app.prepare().then(() => {
const server = express();
server.use(express.json())
server.use(cors())
server.get('/', (req, res) => {
return app.render(req, res, "/");
});
server.get('/api/v1/guildamount', async (req, res) => {
return res.send(1)
})
server.get('*', (req, res) => {
return handle(req, res);
});
server.listen(port, (err) => {
if (err) throw err;
console.log(`Ready on http://localhost:${port}`);
});
});```
im getting to /api/v1/guildamount