You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
620 B
TypeScript
30 lines
620 B
TypeScript
import express, { Request, Response } from 'express'
|
|
import bodyParser from 'body-parser'
|
|
|
|
import productRoutes from './handlers/products'
|
|
import userRoutes from './handlers/users'
|
|
import orderRoutes from './handlers/orders'
|
|
|
|
const app: express.Application = express()
|
|
const address: string = "0.0.0.0:3000"
|
|
const port = 3000;
|
|
|
|
app.use(bodyParser.json())
|
|
|
|
app.get('/', function (req: Request, res: Response) {
|
|
res.send('Main API')
|
|
})
|
|
|
|
productRoutes(app)
|
|
userRoutes(app)
|
|
orderRoutes(app)
|
|
|
|
// Start express server
|
|
app.listen(port, function () {
|
|
console.log(`starting app on: ${address}`)
|
|
})
|
|
|
|
|
|
|
|
export default app;
|