const express = require('express')
const app = express()
const PORT = 3000
app.get('/api/data', async (req, res) => {
const result = await fetchDataFromDB()
res.json({ success: true, data: result })
})
function fetchDataFromDB() {
return new Promise((resolve) => {
setTimeout(() => resolve(['Item 1', 'Item 2', 'Item 3']), 100)
})
}
app.listen(PORT, () => console.log(`Server running on port ${PORT}`))
// High-throughput REST endpoint using Fastify
import Fastify from 'fastify'
const app = Fastify()
app.get('/ping', async () => {
return { success: true, timestamp: Date.now() }
})
app.listen({ port: 3000 }, () => {
console.log('Fast API ready 🚀')
})