Nubo Docs
Search…
⌃K

Fastify

It's easy to deploy a Node Fastify service on Nubo. For a full example, take a look at the Nubo Examples repo.
Below is an example of a basic Fastify service.
const PORT = process.env.PORT || 3000;
const fastify = require('fastify')();
fastify.get('*', async (request, reply) => {
return {
message: 'Fastify on Nubo',
};
});
const start = async () => {
try {
await fastify.listen(PORT, '0.0.0.0');
console.log(`> Ready on http://localhost:${PORT}`);
} catch (err) {
fastify.log.error(err);
process.exit(1);
}
};
start();
Note the host, '0.0.0.0', is set on line 12 in the fastify.listen method call. This is required in order for Nubo to bind the port for the Fastify service.