2️⃣Express API

Express - a minimal and flexible Node.js web application framework

Fastify 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

Last updated