const express = require("express");
const app = express();
const PORT = process.env.PORT || 5900;
const htmlContent = `
RAM Size API
RAM Size API
/get-ram
`;
app.get("/", (req, res) => {
res.send(htmlContent);
});
app.get("/get-ram", (req, res) => {
const ramSizes = [
512,
1024,
2048,
4096
];
const ramMB =
ramSizes[
Math.floor(Math.random() * ramSizes.length)
];
res.json({
ram_mb: ramMB
});
});
app.listen(PORT, "0.0.0.0", () => {
console.log(
`Server running on http://127.0.0.1:${PORT}`
);
});