Skip to content

Commit

Permalink
fixes a few inconsistencies in server routes (vercel#6382)
Browse files Browse the repository at this point in the history
I spotted a few typos in the server files, that might confuse new/unexperienced users. I hope I did catch them all!
  • Loading branch information
vgrafe authored and timneutkens committed Feb 21, 2019
1 parent 9f5d1ef commit d7856c6
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions examples/custom-server-express/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ app.prepare().then(() => {
const server = express()

server.get('/a', (req, res) => {
return app.render(req, res, '/b', req.query)
return app.render(req, res, '/a', req.query)
})

server.get('/b', (req, res) => {
return app.render(req, res, '/a', req.query)
return app.render(req, res, '/b', req.query)
})

server.get('/posts/:id', (req, res) => {
Expand Down
4 changes: 2 additions & 2 deletions examples/custom-server-fastify/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ fastify.register((fastify, opts, next) => {
}

fastify.get('/a', (req, reply) => {
return app.render(req.req, reply.res, '/b', req.query).then(() => {
return app.render(req.req, reply.res, '/a', req.query).then(() => {
reply.sent = true
})
})

fastify.get('/b', (req, reply) => {
return app.render(req.req, reply.res, '/a', req.query).then(() => {
return app.render(req.req, reply.res, '/b', req.query).then(() => {
reply.sent = true
})
})
Expand Down
4 changes: 2 additions & 2 deletions examples/custom-server-koa/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ app.prepare().then(() => {
const router = new Router()

router.get('/a', async ctx => {
await app.render(ctx.req, ctx.res, '/b', ctx.query)
await app.render(ctx.req, ctx.res, '/a', ctx.query)
ctx.respond = false
})

router.get('/b', async ctx => {
await app.render(ctx.req, ctx.res, '/a', ctx.query)
await app.render(ctx.req, ctx.res, '/b', ctx.query)
ctx.respond = false
})

Expand Down
4 changes: 2 additions & 2 deletions examples/custom-server-nodemon/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ app.prepare().then(() => {
const { pathname, query } = parsedUrl

if (pathname === '/a') {
app.render(req, res, '/b', query)
} else if (pathname === '/b') {
app.render(req, res, '/a', query)
} else if (pathname === '/b') {
app.render(req, res, '/b', query)
} else {
handle(req, res, parsedUrl)
}
Expand Down
4 changes: 2 additions & 2 deletions examples/custom-server-polka/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ const handle = app.getRequestHandler()
app.prepare().then(() => {
const server = polka()

server.get('/a', (req, res) => app.render(req, res, '/b', req.query))
server.get('/a', (req, res) => app.render(req, res, '/a', req.query))

server.get('/b', (req, res) => app.render(req, res, '/a', req.query))
server.get('/b', (req, res) => app.render(req, res, '/b', req.query))

server.get('*', (req, res) => handle(req, res))

Expand Down
4 changes: 2 additions & 2 deletions examples/custom-server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ app.prepare().then(() => {
const { pathname, query } = parsedUrl

if (pathname === '/a') {
app.render(req, res, '/b', query)
} else if (pathname === '/b') {
app.render(req, res, '/a', query)
} else if (pathname === '/b') {
app.render(req, res, '/b', query)
} else {
handle(req, res, parsedUrl)
}
Expand Down

0 comments on commit d7856c6

Please sign in to comment.