Added first db connection for a tack endpoint

ref #4
This commit is contained in:
Nicolai Ort 2020-11-25 18:48:27 +01:00
parent 4151f05c24
commit b5518d005f
1 changed files with 3 additions and 5 deletions

View File

@ -3,12 +3,11 @@ import {getConnection} from "typeorm";
import {Track} from "../../models/Track"
const router = Router();
//const manager = getConnection().manager;
router.get('/', async (req, res, next) => {
//let tracks = manager.find(Track);
//res.send(tracks);
res.sendStatus(200);
const trackManager = await getConnection().getRepository(Track);
let tracks = trackManager.count();
return res.send(tracks);
});
router.post('/', async (req, res, next) => {
@ -25,5 +24,4 @@ router.post('/', async (req, res, next) => {
}*/
});
export default router;