Skip to content

Commit 167d8c8

Browse files
committed
initial commit
0 parents  commit 167d8c8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+4501
-0
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/node_modules/
2+
3+
# dotenv environment variable files
4+
5+
.env
6+
.env.development.local
7+
.env.test.local
8+
.env.production.local
9+
.env.local

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Awesome Project Build with Typescript
2+
3+
Steps to run this project:
4+
5+
1. Run `npm i` command
6+
2. Run `npm start` command
7+
3. Start dev mode `npm start dev` command

docker-compose.yaml

Whitespace-only changes.

index.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import express from "express"
2+
import { initializeDatabase } from './src/config'
3+
import { identityRouter } from './src/v1/routes'
4+
import { userRouter } from './src/v1/routes'
5+
import { messageRouter } from './src/v1/routes'
6+
7+
const bootstrap = async () => {
8+
9+
const app = express()
10+
11+
app.use(express.json())
12+
13+
app.use('/api/v1', userRouter)
14+
app.use('/api/v1', identityRouter)
15+
app.use('/api/v1', messageRouter)
16+
17+
// Middleware to catch unmatches routes since currently there's no a clean way to do it with node js
18+
app.use((req, res, next, err) => {
19+
console.log(err)
20+
res.status(404).json({ message: err?.message || 'Route not found' })
21+
})
22+
23+
app.get('/check-health', async (req, res) => {
24+
const message = 'Api Up!'
25+
res.status(200).json({ message })
26+
})
27+
28+
await initializeDatabase()
29+
30+
app.listen(8000, () => {
31+
console.log('App is listening on port 8000')
32+
})
33+
}
34+
35+
bootstrap()

0 commit comments

Comments
 (0)