0

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/std@0.171.0/dotenv/mod.ts";
import { Application } from "https://deno.land/x/oak@v11.1.0/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

Mike MC
  • 1
  • 2
  • Out of curiosity, have you tried using a different port? Like 8000 or 8080. – kemicofa ghost Jan 09 '23 at 16:15
  • yeah, but just figured it out that, its because I imported the connection set up for socket io that's why. And now i have moved it and its working but the socket io is not responding anymore. – Mike MC Jan 10 '23 at 10:31
  • have you enabled the app to use the socket.io port ? – Purefan Jan 11 '23 at 12:18

1 Answers1

0

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,
  });

}
jps
  • 20,041
  • 15
  • 75
  • 79
Mike MC
  • 1
  • 2