-
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 27242e5
Showing
5 changed files
with
42 additions
and
15 deletions.
There are no files selected for viewing
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
11 changes: 11 additions & 0 deletions
11
packages/node/src/generators/application/files/connect/src/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(JSON.stringify({ 'message': 'Hello API' })); | ||
}); | ||
|
||
app.listen(<%= port %>, () => { | ||
// Server is running | ||
}) |
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
18 changes: 18 additions & 0 deletions
18
packages/node/src/generators/application/files/fastify/src/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 { 'message': 'Hello 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/src/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 = { 'message': 'Hello API'}; | ||
}); | ||
|
||
app.listen(<%= port %>, () => { | ||
// Server is running | ||
}); |