[Solved] Can grpc and express server run by same nodejs server, or grpc has to be different server

You cannot add a gRPC server to an Express server. You can run a gRPC server in the same process as an Express server, but they will serve on separate ports and run independently.

This is what I did which is basically triggering the GRPC server start on the listen callback of express

import express from "express";

import { Server,  ServerCredentials } from "grpc";

const server = new Server();
server.bind('', ServerCredentials.createInsecure());

const router = express.Router();

  .use("/", router)
  .listen(3000, () => {

Read more here: Source link