Oak framework Doesnt respond to request in deno deploy

130 views Asked by At

I tried deploying my deno app to deno deploy but I have tried all means to work but still no response and I have no error in logs.

This my code below..

import { load } from "https://deno.land/[email protected]/dotenv/mod.ts";
import { Application } from "https://deno.land/x/[email protected]/mod.ts";

import { socketIo } from "../src/controllers/websocket/setup.ts";

import fileRouter from "./../src/routes/file_rt.ts";
import ordersRouter from "./../src/routes/orders_rt.ts";
import mealRouter from "./../src/routes/meal_rt.ts";
import userRouter from "./../src/routes/user_rt.ts";

load();

const app = new Application();

app.use(await rateLimit);


app.use(userRouter.routes());
app.use(ordersRouter.routes());
app.use(mealRouter.routes());
app.use(fileRouter.routes());


app.use(userRouter.allowedMethods());
app.use(ordersRouter.allowedMethods());
app.use(mealRouter.allowedMethods());
app.use(fileRouter.allowedMethods());

socketIo();

await app.listen({port:80});
 

I tried to test an api route using postman but the endpoint didn't log anything

1

There are 1 answers

0
Mike MC On BEST ANSWER

I have fixed it by removing the socket IO connection I imported. [ socketIO() ]

But now the socket connection is not working.

export const socketIo = async () => {

  
  io.on("connection", (socket) => {
    
    console.log(`socket ${socket.id} connected`);
    
    skt = socket;
    
    signUSER(socket);
    
    socket.on("disconnect", (reason) => {
      console.log(`socket ${socket.id} disconnected due to ${reason}`);
    });
    
    console.log("Socket Hit ✨");
  });


  await serve(io.handler(), {
    port: 3000,
  });

}