How to use the parsePath function from history

Find comprehensive JavaScript history.parsePath code examples handpicked from public code repositorys.

140
141
142
143
144
145
146
147
148
149
150
151
function serveIndexWithRouting(req, res, file) {
  const envRequire = isProduction ? require : require('import-fresh')
  const template = envRequire(file)


  const routes = template.routes
  const location = parsePath(req.url)


  return Promise.resolve(routes)
    .then(routes => (routes && routes.match(location, req)) || { status: 200, data: null })
    .then(({ status, headers, data }) =>
fork icon3
star icon10
watch icon4

13
14
15
16
17
18
19
20
21
22
  basename,
  children,
  location: locationProp = "/"
}) {
  if (typeof locationProp === "string") {
    locationProp = history.parsePath(locationProp);
  }

  let action = history.Action.Pop;
  let location = {
fork icon1
star icon0
watch icon1

+ 3 other calls in file