Merged some functions in database/utils.ts to attempt to shorten code length, Also changed tests to work with the new datatypes

This commit is contained in:
Esad Mustafoski
2024-11-06 04:49:18 +01:00
parent 108b3f0d50
commit c786ddd895
5 changed files with 208 additions and 66 deletions

View File

@@ -1,7 +1,7 @@
/// <reference lib="deno.ns" />
/**
/**
* @author Esad Mustafoski
* @description Main API file, Handles all the routing/api stuff
* Main API file, Handles all the routing/api stuff
*/
// +++ IMPORTS ------------------------------------------------------ //
@@ -9,12 +9,10 @@ import { Application, Router } from "https://deno.land/x/oak/mod.ts";
import { oakCors } from "https://deno.land/x/cors/mod.ts";
import * as db_utils from "../database/utils.ts";
// +++ VARIABLES ---------------------------------------------------- //
const router = new Router();
const app = new Application();
// +++ ROUTER ------------------------------------------------------- //
// Creates the routes for the API server.
// Example: localhost:8000/api will show "testAPIPoint"
@@ -36,10 +34,9 @@ router
ctx.response.body = { getPosts, countedPosts };
});
app.use(oakCors());
app.use(router.routes());
app.use(router.allowedMethods());
export { app };
await app.listen({ port: 8000 });
await app.listen({ port: 8000 });