enkaNetwork
GitHubNPM
  • ✨Overview
  • 📦Quick Start | Installation
  • 🖇️TypeScript usage
  • ⚙️Class description
    • 📝EnkaNetwork
    • 💾AssetsUpdater
    • 🔎AssetsFinder
  • 🔗Methods
    • 👤fetchUser
    • 🕵️fetchProfileInfo
    • 🌟fetchEnkaProfile
    • 📕fetchEnkaHoyos
    • 🔹fetchEnkaHoyo
    • 🟣fetchEnkaHoyoBuilds
    • 🚩setLanguage
  • 🎓Models
    • EnkaProfile
    • Character
      • Character
      • CharacterConstellation
      • CharacterReliquary
      • CharacterSkill
      • CharacterStats
      • CharacterWeapon
    • PlayerInfo
      • CharacterPreview
      • Namecard
      • PlayerInfo
      • ProfilePicture
    • Fetcher
      • FetchEnkaHoyosBuilds
      • FetchEnkaHoyo
      • FetchEnkaProfile
      • FetchUserUID
      • FetchProfileInfo
  • ✏️Examples
    • 1️⃣Simple usage
    • 2️⃣Express API
    • 3️⃣Fastify API
    • 4️⃣Telegram bot
Powered by GitBook
On this page

Was this helpful?

  1. Examples

Express API

PreviousSimple usageNextFastify API

Last updated 1 year ago

Was this helpful?

- a minimal and flexible Node.js web application framework

is a better framework than express

import express from "express";
import { EnkaNetwork } from "enkanetwork";

const app = express();
const port = 80;
const enka = new EnkaNetwork();

app.get("/:language/:uid", async (req, res) => {
    const { language, uid } = req.params;

    try {
        const data = await enka.fetchUser(uid, language);

        return res.json(data);
    } catch (err) {
        return res.status(500).json({
            message: err.message,
        });
    }
});

await enka.assetsUpdater.fetchAssets();
app.listen(port, () =>
    console.log(`[SERVER] Server listening on port ${port}`)
);

Now we can access our server

✏️
2️⃣
Express
Fastify