Custom Server app.render() return 404 not found

Highlighted
Shopify Partner
3 0 0

Hey Guys

I really need help.

Now I'm trying to create a dashboard route that can render next js page. Good news is, it's loading  the page but returned status is "404" Here's my routes:

	router.get('/dashboard', async (ctx) => {
	  await app.render(ctx.req, ctx.res, '/', ctx.query);
	  ctx.respond = false;
		ctx.res.statusCode = 200;
	});

	router.get('*', async (ctx) => {
	  await handle(ctx.req, ctx.res);
	  ctx.respond = false;
		ctx.res.statusCode = 200;
	});

 

when I initialize statusCode first (as below) the returned status will be "200"

	router.get('/dashboard', async (ctx) => {
		ctx.res.statusCode = 200;
	  await app.render(ctx.req, ctx.res, '/', ctx.query);
	  ctx.respond = false;
	});

 

Why am I getting a 404 status!

0 Likes