v2.5.2
Giriş yap

ExpressJS to NextJS

thrasher
429 defa görüntülendi ve 1 kişi tarafından değerlendirildi
app.get("/paylas", (req, res) => {
    if (
      !req.user ||
      !client.guilds.cache.get(id.guildid).members.cache.has(req.user.id)
    )
      return res.redirect(
        url.format({
          pathname: "/error",
          query: {
            statuscode: 138,
            message:
              "Staff only."
          }
        })
      );
    res.render("share", {
      user: req.user
    });
  });
  app.post("/paylasim", (req, res) => {
    let guild = client.guilds.cache.get(id.guildid);
    let member = req.user ? guild.members.cache.get(req.user.id) : null;
    let rank = "community";
    if (
      member &&
      id.blacklist.some(id => member.roles.cache.has(id))
    )
      return res.redirect(
        url.format({
          pathname: "/hata",
          query: {
            statuscode: 502,
            message: "No permission!"
          }
        })
      );
    if (
      member &&
      (member.roles.cache.has(id.owner) ||
        member.roles.cache.has(id.coder) ||
        member.roles.cache.has(id.staff))
    )
      rank = req.body.kod_rank;
  
    let auht = [];
    if (req.user) auht.push(req.user);
    let auth_arr = req.body.author.split(",");
  
    auth_arr.forEach(auth => {
      let user = client.users.cache.get(auth);
      auht.push(req.user);
    });
  
    let obj = {
      author: req.auth,
      isim: req.body.code_name,
      id: randomString({ length: 10 }),
      desc: req.body.desc,
      modules: req.body.modules.split(","),
      icon: req.user
        ? `https://cdn.discordapp.com/avatars/${req.user.id}/${req.user.avatar}.png`
        : `https://cdn.discordapp.com/icons/${id.guildid}/a_830c2bcfa4f1529946e82f15441a1227.jpg`,
      main_code: req.body.main_code,
      komutlar_code: req.body.code_commands,
      kod_rank: rank,
      k_adi: req.user.username,
      date: new Date(Date.now()).toLocaleDateString()
    };
    if (req.user) db.api.add(`${req.user.id}.paylasilan`, 1);
    db[obj.kod_rank].set(`kodlar.${obj.isim}`, obj);
    res.redirect(`/${obj.code_rank}/${obj.id}`);
  });

Yukarıda verdiğim kod express kodu bildiğiniz gibi, ben bunu nextjs de kullanmak istiyorum nasıl dönüştürebilirim ?

thrasher
1239 gün önce

Ya da benzerini nasıl yapabilirim ?