|
|
|
@ -3,11 +3,7 @@ import { port } from "./environment"
|
|
|
|
import express, { Express, NextFunction, Request, Response } from "express";
|
|
|
|
import express, { Express, NextFunction, Request, Response } from "express";
|
|
|
|
import cookieParser from "cookie-parser";
|
|
|
|
import cookieParser from "cookie-parser";
|
|
|
|
|
|
|
|
|
|
|
|
import { client } from "./db";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import router from "./routes";
|
|
|
|
import router from "./routes";
|
|
|
|
import { UserAuth } from "./middlewares/auth";
|
|
|
|
|
|
|
|
import { AuthedRequest } from "./interfaces/auth";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const app: Express = express();
|
|
|
|
const app: Express = express();
|
|
|
|
|
|
|
|
|
|
|
|
@ -16,12 +12,7 @@ app.use(express.json());
|
|
|
|
app.use(router);
|
|
|
|
app.use(router);
|
|
|
|
|
|
|
|
|
|
|
|
app.get("/", async (req: Request, res: Response) => {
|
|
|
|
app.get("/", async (req: Request, res: Response) => {
|
|
|
|
const data = await client.query("SELECT CURRENT_DATE ;")
|
|
|
|
res.send({status: "OK"});
|
|
|
|
res.send(data);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.get("/test", UserAuth, async (req: AuthedRequest, res: Response) => {
|
|
|
|
|
|
|
|
res.send(req.user);
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
app.use((err: Error, req: Request, res: Response, next: NextFunction) => {
|
|
|
|
app.use((err: Error, req: Request, res: Response, next: NextFunction) => {
|
|
|
|
|