Commit d7856c66 authored by Vincent Grafé's avatar Vincent Grafé Committed by Tim Neutkens

fixes a few inconsistencies in server routes (#6382)

I spotted a few typos in the server files, that might confuse new/unexperienced users. I hope I did catch them all!
parent 9f5d1ef3
...@@ -10,11 +10,11 @@ app.prepare().then(() => { ...@@ -10,11 +10,11 @@ app.prepare().then(() => {
const server = express() const server = express()
server.get('/a', (req, res) => { 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) => { 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) => { server.get('/posts/:id', (req, res) => {
......
...@@ -18,13 +18,13 @@ fastify.register((fastify, opts, next) => { ...@@ -18,13 +18,13 @@ fastify.register((fastify, opts, next) => {
} }
fastify.get('/a', (req, reply) => { 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 reply.sent = true
}) })
}) })
fastify.get('/b', (req, reply) => { 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 reply.sent = true
}) })
}) })
......
...@@ -12,12 +12,12 @@ app.prepare().then(() => { ...@@ -12,12 +12,12 @@ app.prepare().then(() => {
const router = new Router() const router = new Router()
router.get('/a', async ctx => { 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 ctx.respond = false
}) })
router.get('/b', async ctx => { 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 ctx.respond = false
}) })
......
...@@ -13,9 +13,9 @@ app.prepare().then(() => { ...@@ -13,9 +13,9 @@ app.prepare().then(() => {
const { pathname, query } = parsedUrl const { pathname, query } = parsedUrl
if (pathname === '/a') { if (pathname === '/a') {
app.render(req, res, '/b', query)
} else if (pathname === '/b') {
app.render(req, res, '/a', query) app.render(req, res, '/a', query)
} else if (pathname === '/b') {
app.render(req, res, '/b', query)
} else { } else {
handle(req, res, parsedUrl) handle(req, res, parsedUrl)
} }
......
...@@ -9,9 +9,9 @@ const handle = app.getRequestHandler() ...@@ -9,9 +9,9 @@ const handle = app.getRequestHandler()
app.prepare().then(() => { app.prepare().then(() => {
const server = polka() 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)) server.get('*', (req, res) => handle(req, res))
......
...@@ -13,9 +13,9 @@ app.prepare().then(() => { ...@@ -13,9 +13,9 @@ app.prepare().then(() => {
const { pathname, query } = parsedUrl const { pathname, query } = parsedUrl
if (pathname === '/a') { if (pathname === '/a') {
app.render(req, res, '/b', query)
} else if (pathname === '/b') {
app.render(req, res, '/a', query) app.render(req, res, '/a', query)
} else if (pathname === '/b') {
app.render(req, res, '/b', query)
} else { } else {
handle(req, res, parsedUrl) handle(req, res, parsedUrl)
} }
......
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