Commit 33fa9312 authored by Arunoda Susiripala's avatar Arunoda Susiripala Committed by Naoyuki Kanezawa

Resolve the path in renderJSON before serving. (#599)

parent 81a67581
......@@ -5,6 +5,7 @@ import fs from 'mz/fs'
import send from 'send'
import accepts from 'accepts'
import requireModule from './require'
import resolvePath from './resolve'
import readPage from './read-page'
import { Router } from '../lib/router'
import Head, { defaultHead } from '../lib/head'
......@@ -97,7 +98,7 @@ async function doRender (req, res, pathname, query, {
}
export async function renderJSON (req, res, page, { dir = process.cwd() } = {}) {
const pagePath = join(dir, '.next', 'bundles', 'pages', `${page}.json`)
const pagePath = await resolvePath(join(dir, '.next', 'bundles', 'pages', page))
return serveStaticWithGzip(req, res, pagePath)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment