lots of layout; server not really running yet

This commit is contained in:
Mikayla Dobson
2022-11-17 18:08:31 -06:00
parent 798da777a9
commit 628d0dc04b
11 changed files with 2086 additions and 71 deletions

View File

@@ -1,6 +1,11 @@
import { Express } from "express"
import { userRoute } from "./users";
export const routes = (app: Express, passport?: any) => {
console.log('routes called');
userRoute(app);
app.get('/hello', (req, res) => {
res.send({ message: "hello from the server!!" });
})

View File

@@ -0,0 +1,20 @@
import db, { sql } from '../db';
import { Express, Router } from 'express';
import UserCtl from '../controllers/UserCtl';
const router = Router();
const userCtl = new UserCtl();
export const userRoute = (app: Express) => {
app.use('/users', router);
// get all users
router.get('/', async (req, res, next) => {
await db.query(sql`SELECT * FROM users`).then(response => console.log(response));
// const data = userCtl.getAll();
// res.status(200).send(data);
})
router.get('/hidden-thing', (req, res) => {
res.send('does this route actually work?');
})
}