Skip to content

Commit

Permalink
add print routes
Browse files Browse the repository at this point in the history
  • Loading branch information
leandroandrade committed Apr 1, 2024
1 parent afd1ab9 commit b370c71
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions print-routes/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const Fastify = require('fastify');

(async () => {
const app = Fastify({ logger: true });

app.get('/', async (req, res) => {
return { hello: 'root' };
});

app.get('/new', async (req, res) => {
return { hello: 'new' };
});

app.get('/old', async (req, res) => {
return { hello: 'old' };
});

app.ready(() => {
const tree = app.printRoutes();
console.log(tree);
});

await app.listen({ port: 3000 });
})();

0 comments on commit b370c71

Please sign in to comment.