aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/app.ts22
-rw-r--r--src/index.ts15
2 files changed, 37 insertions, 0 deletions
diff --git a/src/app.ts b/src/app.ts
new file mode 100644
index 0000000..fe00367
--- /dev/null
+++ b/src/app.ts
@@ -0,0 +1,22 @@
+import * as express from 'express'
+
+class App {
+ public express
+
+ constructor () {
+ this.express = express()
+ this.mountRoutes()
+ }
+
+ private mountRoutes (): void {
+ const router = express.Router()
+ router.get('/', (req, res) => {
+ res.json({
+ message: 'Hello World!'
+ })
+ })
+ this.express.use('/', router)
+ }
+}
+
+export default new App().express \ No newline at end of file
diff --git a/src/index.ts b/src/index.ts
new file mode 100644
index 0000000..80a02d9
--- /dev/null
+++ b/src/index.ts
@@ -0,0 +1,15 @@
+console.log('Hello, TypeScript!');
+
+
+
+import app from './app'
+
+const port = process.env.PORT || 3000
+
+app.listen(port, (err) => {
+ if (err) {
+ return console.log(err)
+ }
+
+ return console.log(`server is listening on ${port}`)
+}) \ No newline at end of file