Skip to content

[SPAM] #66674

Closed as not planned
Closed as not planned

Description

@mee28suteesak-crypto

const express = require("express");
const app = express();

app.use(express.json());

const PRICE_SATANG = 10;

// ตัวอย่างเพื่อทดลองเท่านั้น
// ระบบจริงต้องตรวจสอบ API Key จากฐานข้อมูล
const apiKeys = new Map([
["demo-key", { userId: "user-001" }]
]);

const usage = new Map();

app.post("/api/quote", (req, res) => {
const key = req.get("x-api-key");
const account = apiKeys.get(key);

if (!account) {
return res.status(401).json({
error: "Invalid API key"
});
}

const userId = account.userId;
usage.set(userId, (usage.get(userId) || 0) + 1);

res.json({
message: "Request accepted",
userId,
requestCount: usage.get(userId),
feeSatang: PRICE_SATANG,
feeBaht: PRICE_SATANG / 100,
note: "Demo only; no SOL was transferred"
});
});

app.listen(3000, () => {
console.log("API listening on port 3000");
});

node server.js

curl -X POST http://localhost:3000/api/quote
-H "Content-Type: application/json"
-H "x-api-key: demo-key"
-d '{}'

Activity

  1. mee28suteesak-crypto commented on Oct 12, 2026

    @mee28suteesak-crypto
    Author
  2. changed the title [-]npm init -y npm install express[/-] [+][SPAM][/+] on Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidIssues and PRs that are invalid.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions