Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
2953a01c
Commit
2953a01c
authored
May 27, 2017
by
George Pantazis
Committed by
Arunoda Susiripala
May 27, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make file-system based routes optional for custom servers (#914)
parent
56cf8ad0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
config.js
server/config.js
+2
-1
index.js
server/index.js
+4
-2
No files found.
server/config.js
View file @
2953a01c
...
@@ -8,7 +8,8 @@ const defaultConfig = {
...
@@ -8,7 +8,8 @@ const defaultConfig = {
webpackDevMiddleware
:
null
,
webpackDevMiddleware
:
null
,
poweredByHeader
:
true
,
poweredByHeader
:
true
,
distDir
:
'.next'
,
distDir
:
'.next'
,
assetPrefix
:
''
assetPrefix
:
''
,
useFileSystemPublicRoutes
:
true
}
}
export
default
function
getConfig
(
dir
)
{
export
default
function
getConfig
(
dir
)
{
...
...
server/index.js
View file @
2953a01c
...
@@ -179,9 +179,11 @@ export default class Server {
...
@@ -179,9 +179,11 @@ export default class Server {
'/static/:path+'
:
async
(
req
,
res
,
params
)
=>
{
'/static/:path+'
:
async
(
req
,
res
,
params
)
=>
{
const
p
=
join
(
this
.
dir
,
'static'
,
...(
params
.
path
||
[]))
const
p
=
join
(
this
.
dir
,
'static'
,
...(
params
.
path
||
[]))
await
this
.
serveStatic
(
req
,
res
,
p
)
await
this
.
serveStatic
(
req
,
res
,
p
)
},
}
}
'/:path*'
:
async
(
req
,
res
,
params
,
parsedUrl
)
=>
{
if
(
this
.
config
.
useFileSystemPublicRoutes
)
{
routes
[
'/:path*'
]
=
async
(
req
,
res
,
params
,
parsedUrl
)
=>
{
const
{
pathname
,
query
}
=
parsedUrl
const
{
pathname
,
query
}
=
parsedUrl
await
this
.
render
(
req
,
res
,
pathname
,
query
)
await
this
.
render
(
req
,
res
,
pathname
,
query
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment