Skip to content

Instantly share code, notes, and snippets.

@davidcsejtei
Created October 18, 2020 09:26
Show Gist options
  • Select an option

  • Save davidcsejtei/fd48018494b569104f27bac6c4d4137e to your computer and use it in GitHub Desktop.

Select an option

Save davidcsejtei/fd48018494b569104f27bac6c4d4137e to your computer and use it in GitHub Desktop.
TypeORM - index.ts
import "reflect-metadata";
import {createConnection, ConnectionOptions} from "typeorm";
import http from "http";
import express from 'express';
import config from "../ormconfig.json";
createConnection(config as ConnectionOptions).then(async connection => {
const app = express();
app.use(express.json());
const server = new http.Server(app);
server.listen(3001);
}).catch(error => {
console.log(error);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment