master-thesis/code/scenarios/one-sat-two-base/base/index.js

21 lines
440 B
JavaScript
Raw Permalink Normal View History

2023-05-11 17:44:13 +02:00
import Fastify from 'fastify'
const app = Fastify({ logger: { base: false } })
app.post('/transmit', async (request) => {
request.log.info({ data: request.body })
})
app.get('/time', async () => {
return new Date().toISOString()
})
try {
process.on('SIGINT', () => app.close())
process.on('SIGTERM', () => app.close())
await app.listen({ port: 3000, host: '0.0.0.0' })
} catch (err) {
app.log.error(err)
process.exit(1)
}