Skip to content
This repository has been archived by the owner on Nov 23, 2024. It is now read-only.

Commit

Permalink
Initialised typescript example
Browse files Browse the repository at this point in the history
  • Loading branch information
Samrith Shankar committed Feb 22, 2020
1 parent 9aadff8 commit 723d41b
Show file tree
Hide file tree
Showing 5 changed files with 880 additions and 2 deletions.
8 changes: 8 additions & 0 deletions examples/express-typescript/.nodehawkrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"exec": "ts-node src/server",
"env": {
"NODE_ENV": "development",
"MY_MESSAGE": "This is my message to the world!"
},
"logLevel": 4
}
18 changes: 16 additions & 2 deletions examples/express-typescript/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
{
"name": "nodehawk-express-typescript",
"version": "1.0.0",
"description": "An Express Typescript boilerplate with Nodehawk.",
"description": "An Express Javascript boilerplate with Nodehawk.",
"repository": "[email protected]:samrith-s/nodehawk.git",
"author": "Samrith Shankar <[email protected]>",
"license": "MIT",
"private": true
"private": true,
"scripts": {
"start": "nodehawk"
},
"dependencies": {
"chalk": "link:../../node_modules/chalk",
"express": "^4.17.1"
},
"devDependencies": {
"@types/express": "^4.17.2",
"@types/node": "^13.7.4",
"nodehawk": "link:../..",
"ts-node": "^8.6.2",
"typescript": "^3.8.2"
}
}
14 changes: 14 additions & 0 deletions examples/express-typescript/src/server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import * as express from "express";
import chalk from "chalk";

const app = express();

app.get("/", (req, res) => {
res.send(process.env.MY_MESSAGE);
});

app.listen(process.env.PORT, () => {
console.log(
chalk`{yellow.bold App running on http://localhost:${process.env.PORT}}`
);
});
11 changes: 11 additions & 0 deletions examples/express-typescript/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"include": ["./src/**/*.ts", "./src/**/*.json"],
"exclude": ["node_modules"],
"compilerOptions": {
"baseUrl": "src",
"outDir": "build",
"rootDir": ".",
"module": "commonjs",
"target": "es2015"
}
}
Loading

0 comments on commit 723d41b

Please sign in to comment.