jelugbad
jelugbad
TTCTheo's Typesafe Cult
Created by jelugbad on 6/30/2023 in #questions
[SOLVED] Next.js App Router with Express Custom Server
I finally got it to work. I spent 2 days trying to figure this out.... The mistake I was making was that I was not passing hostname and port when declaring the next app in the custom Express server.js file, as in const app = next({ dev, hostname, port }) I was just passing "dev". Also, I had to define hostname like so: const hostname = '127.0.0.1' Declaring it as they provide in the docs, like so const hostname = 'localhost' did not work for me. What caused the confusion is the custom server example they provide in the Next.js docs are listed under the "Pages Router", not "App Router".
4 replies
TTCTheo's Typesafe Cult
Created by jelugbad on 6/30/2023 in #questions
[SOLVED] Next.js App Router with Express Custom Server
UDPATE: I just confirmed. The Express custom router works with the Next.js Pages Router. Have not been able to get it to work with the Next.js App Router.
4 replies