-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(node): add templates for nodejs frameworks
Now that the ground work has been set for one framework. This PR adds template support for the remaining frameworks
- Loading branch information
1 parent
13a61e9
commit 401a913
Showing
3 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
packages/node/src/generators/application/files/connect/main.ts__tmpl__
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
}) |
18 changes: 18 additions & 0 deletions
18
packages/node/src/generators/application/files/fastify/main.ts__tmpl__
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
11
packages/node/src/generators/application/files/koa/main.ts__tmpl__
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
}); |