createSitePathResolver()

Create a function to resolve a path relative to the site within Nitro.

Same as createSitePathResolver() but you will need to provide the request context.

Usage

serverMiddleware.ts
import { createSitePathResolver } from '#imports'

export default defineEventHandler((e) => {
  const resolvePath = createSitePathResolver(e, {
    canonical: true,
  })

  resolvePath('/about')
  // https://www.example.com/about
})
Did this page help you?