initial routes
This commit is contained in:
parent
2002b00816
commit
6c555355ac
4 changed files with 44 additions and 0 deletions
27
src/index.ts
Normal file
27
src/index.ts
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
import { pogo } from "../deps.ts";
|
||||||
|
import { database } from "../utils/index.ts"
|
||||||
|
import routes from "./routes.generated.ts"
|
||||||
|
|
||||||
|
const env = {
|
||||||
|
port: Number(Deno.env.get("POGO_PORT")) || 3000,
|
||||||
|
}
|
||||||
|
|
||||||
|
const server = pogo.server({
|
||||||
|
port: env.port
|
||||||
|
})
|
||||||
|
|
||||||
|
server.router.get('/', async () => {
|
||||||
|
return `${JSON.stringify(await database.from("void_socials"))}`;
|
||||||
|
});
|
||||||
|
|
||||||
|
routes.forEach(route => {
|
||||||
|
server.route({ method: route.method, handler: route.handler, path: route.route })
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
await server.start()
|
||||||
|
console.log(`Dreamland online on Port ${env.port}`)
|
||||||
|
|
4
src/routes/api/hewwo.ts
Normal file
4
src/routes/api/hewwo.ts
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
export const method = ['*']
|
||||||
|
export const handler = () => {
|
||||||
|
return "api/hewwo"
|
||||||
|
}
|
9
src/routes/api/index.ts
Normal file
9
src/routes/api/index.ts
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
import { database } from "../../../utils/index.ts"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export const method = ['*']
|
||||||
|
export const handler = async () => {
|
||||||
|
return `${JSON.stringify(await database.from("void_socials"))}`;
|
||||||
|
|
||||||
|
}
|
4
src/routes/index.ts
Normal file
4
src/routes/index.ts
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
export const method = ['*']
|
||||||
|
export const handler = () => {
|
||||||
|
return "index"
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue