Skip to content

Commit

Permalink
feat(node): add templates for nodejs frameworks
Browse files Browse the repository at this point in the history
Now that the ground work has been set for one framework. This PR adds template support for the
remaining frameworks
  • Loading branch information
ndcunningham committed Jan 9, 2023
1 parent 13a61e9 commit 401a913
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import connect from 'connect';

const app = connect();

app.use((req, res) => {
res.end('Hello from Nrwl API!');
});

app.listen(<%= port %>, () => {
// Server is running
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import fastify from 'fastify';

const app = fastify();

app.get('/', async (req, res) => {
return 'Hello from Nrwl API!'
});

const start = async() => {
try {
await app.listen({ port: <%= port %> })
} catch (err) {
// Errors are logged here
process.exit(1);
}
}

start();
11 changes: 11 additions & 0 deletions packages/node/src/generators/application/files/koa/main.ts__tmpl__
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import koa from 'koa';

const app = new koa();

app.use(async ctx =>{
ctx.body = 'Hello from Nrwl 🐳 API';
});

app.listen(<%= port %>, () => {
// Server is running
});

0 comments on commit 401a913

Please sign in to comment.