config endpoint
This commit is contained in:
parent
eaa2d29aff
commit
a01abce47b
2 changed files with 11 additions and 2 deletions
|
@ -1,13 +1,14 @@
|
||||||
import token from "./routes/token";
|
import token from "./routes/token";
|
||||||
|
import config from "./routes/config";
|
||||||
|
|
||||||
Bun.serve({
|
Bun.serve({
|
||||||
port: 3000,
|
port: 3000,
|
||||||
async fetch(req) {
|
async fetch(req) {
|
||||||
const url = new URL(req.url);
|
const url = new URL(req.url);
|
||||||
|
|
||||||
console.log(`${new Date()} ${req.method} ${url.pathname}`);
|
console.log(`${new Date().toUTCString()} ${req.method} ${url.pathname}`);
|
||||||
|
|
||||||
if (url.pathname === "/") return new Response("hello yes this is garf");
|
if (url.pathname === "/") return await config(req);
|
||||||
if (url.pathname === "/token") return await token(req);
|
if (url.pathname === "/token") return await token(req);
|
||||||
return new Response("garf dont know what want...");
|
return new Response("garf dont know what want...");
|
||||||
},
|
},
|
||||||
|
|
8
src/routes/config.ts
Normal file
8
src/routes/config.ts
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
export default async function (req: Request): Promise<Response> {
|
||||||
|
return new Response(
|
||||||
|
JSON.stringify({
|
||||||
|
DISCORD_CLIENT_ID: process.env.DISCORD_CLIENT_ID,
|
||||||
|
}),
|
||||||
|
{ headers: { "Content-Type": "application/json" } }
|
||||||
|
);
|
||||||
|
}
|
Loading…
Reference in a new issue