Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export const databaseInitializer = async () => {
- return await createConnection({
- type : 'postgres',
- host : '0.0.0.0',
- port : 5432,
- username : 'finch',
- password : 'finch',
- database : 'finch_development',
- entities: [
- Card,
- ],
- synchronize: true,
- }).then((connection) => {
- console.log('Database connection established');
- // Create new instance
- const card = new Card();
- card.title = 'First card';
- card.done = false;
- // Persist to database
- return connection.manager
- .save(card)
- .then(card => {
- console.log('card saved');
- })
- });
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement