0

I set up a server with next-connect. Now how can I move requests to the pages folder of my nextjs program? This is my server js file:

const nc = require("next-connect");

const {auth} = require("../app/middlewares/auth");

const handler = nc()
.use(auth)
.get((req, res) => {
console.log('->', req.session.get('user'))
// Render the requested page from the pages folder
}).post();

createServer(handler).listen(process.env.PORT);
Jack Pate
  • 169
  • 4
  • 15

1 Answers1

0

Looks like you created a custom backend for your Next.js project probably using Node.js and express. This requires some critical changes throughout the project.

You can read the documentation here. https://nextjs.org/docs/advanced-features/custom-server

ABDULLOKH MUKHAMMADJONOV
  • 4,249
  • 3
  • 22
  • 40
  • Thanks. I solved my problem by adding express to my web application, as well as using the nextjs project management structure. – Jack Pate Sep 26 '21 at 06:10