Last active
October 17, 2017 20:48
-
-
Save govorov/2409dae530224524f0a85ecf1e5b98a0 to your computer and use it in GitHub Desktop.
graphql post
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
// | |
// initializers/database.ts | |
// | |
const path = require('path'); | |
import { createConnection } from 'typeorm'; | |
import { Card } from 'entities/card'; | |
export const databaseInitializer = async () => { | |
return await createConnection({ | |
driver: { | |
type : 'postgres', | |
host : '0.0.0.0', | |
port : 5432, | |
username : 'db_user', | |
password : 'db_password', | |
database : 'db_name' | |
}, | |
entities: [ | |
Card, | |
], | |
logging: ['query', 'error'], | |
synchronize: true, | |
}).then((...args) => { | |
debugger | |
console.log('Database connection established'); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment