-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.ts
More file actions
35 lines (27 loc) · 777 Bytes
/
app.ts
File metadata and controls
35 lines (27 loc) · 777 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import express from 'express'
import tokenRoutes from './routes/tokenRoutes'
// import tweetRoutes from "routes/tweetRoutes";
import cors from 'cors'
import transactionRoutes from './routes/transactionRoutes'
import { errorHandler } from './utils/errorHandler'
import { logger } from './utils/logger'
const app = express()
app.use(express.json())
app.use(cors())
app.use((req, res, next) => {
logger.info(`[${req.method}] ${req.url}`)
next()
})
app.get('/health', (req, res, next) => {
return res.send({
status: 'ok',
message: 'Server is running',
})
})
// Set up routes
app.use('/api', tokenRoutes)
// app.use("/api", tweetRoutes);
app.use('/api', transactionRoutes)
// Error handler middleware
app.use(errorHandler)
export default app