Link Search Menu Expand Document

Dynamic Routes

Example

  • pages/api/post/[pid].js
  • matches api/post/abc
export default (req, res) => {
  const {
    query: { pid },
  } = req

  res.end(`Post: ${pid}`)
}

Middleware


Copyright © 2020 Thence LLC