#fetch

26 messages · Page 1 of 1 (latest)

stone moss
#

How do I fetch a piece of data through server in my page.tsx

spare cedarBOT
#

🔎 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)

near patio
stone moss
#

but when i do that

#

i get this

near patio
timber sonnet
stone moss
#

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

spare cedarBOT
#
✅ Success!

This question has been marked as answered! If you have any other questions, feel free to create another post

Jump to answer

[Click here](#1183092170417246258 message)

stone moss
#

this

timber sonnet
#

the issue is with your api

stone moss
#

im using cors

timber sonnet
#

idk what that is

#

send here the code

stone moss
#

alr

stone moss
# timber sonnet idk what that is
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