Compare commits

...

4 Commits

Author SHA1 Message Date
21645be25c Merge branch 'main' of git.odit.services:lfk/backend into main 2020-11-25 18:48:30 +01:00
b5518d005f Added first db connection for a tack endpoint
ref #4
2020-11-25 18:48:27 +01:00
4151f05c24 Loading db first
ref #4
2020-11-25 18:47:47 +01:00
29979a37ab Changed type to const
ref #4
2020-11-25 18:33:05 +01:00
2 changed files with 5 additions and 7 deletions

View File

@ -4,8 +4,8 @@ import databaseLoader from "./database";
import {Application} from "express";
export default async (app: Application) => {
await databaseLoader();
await expressLoader(app);
await routeLoader(app);
databaseLoader();
return app;
};

View File

@ -2,13 +2,12 @@ import {Router} from 'express';
import {getConnection} from "typeorm";
import {Track} from "../../models/Track"
var router = Router();
//const manager = getConnection().manager;
const router = Router();
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;