import * as express from 'express' import * as bodyParser from 'body-parser' import routes from './routes/index' import { createConnection } from 'typeorm' import * as cors from 'cors' const PORT = 3000 createConnection() .then(async (connection) => { const app = express() // configure multer app.use(cors()) app.use(bodyParser.urlencoded({ extended: false })) app.use(bodyParser.json()) app.get('/', (req, res) => res.send('Hello World!')) app.use('/', routes) app.listen(PORT, () => console.log(`Example app listening at http://localhost:${PORT}`) ) }) .catch((error) => console.log('TypeORM connection error: ', error))