Created
October 18, 2020 09:30
-
-
Save davidcsejtei/a8284e4dfa2e7722a40aaec10fac3bbf to your computer and use it in GitHub Desktop.
Express application uses TypeORM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import "reflect-metadata"; | |
| import {createConnection, ConnectionOptions} from "typeorm"; | |
| import http from "http"; | |
| import express from 'express'; | |
| import config from "../ormconfig.json"; | |
| import GetAllUsers from "./controllers/GetAllUsers"; | |
| createConnection(config as ConnectionOptions).then(async connection => { | |
| const app = express(); | |
| app.use(express.json()); | |
| const server = new http.Server(app); | |
| server.listen(3001); | |
| app.get('/users/all', GetAllUsers); | |
| }).catch(error => { | |
| console.log(error); | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment