This repository has been archived on 2020-11-04. You can view files and clone it, but cannot push or open issues or pull requests.
samurai-next/src/index.ts

23 lines
700 B
TypeScript

import "reflect-metadata";
import {createConnection} from "typeorm";
import {Address} from "./entity/Address";
createConnection().then(async connection => {
console.log("Inserting a new user into the database...");
const addr = new Address();
addr.street = "Test";
addr.number = "1";
addr.city = "herzo";
addr.plz = "91074";
addr.state = "Franken";
addr.country = "Germany"
await connection.manager.save(addr);
console.log("Saved a new addr with id: " + addr.id);
console.log("Loading addr from the database...");
const addrs = await connection.manager.find(Address);
console.log("Loaded addr: ", addrs);
}).catch(error => console.log(error));