Skip to content

Route shadowing #1976

@aymericbeaumet

Description

@aymericbeaumet

It seems Hapi does route shadowing. Is it on purpose?

Considering the example below, the /foo/bar route will never be reached (404).

'use strict';

var Hapi = require('hapi');

var server = new Hapi.Server('localhost', 8080);
server.route(
  { method: 'GET', path: '/foo', handler: handler },
  { method: 'GET', path: '/foo/bar', handler: handler }
);
server.start();

function handler(request, reply) {
  return reply(request.path);
}

Metadata

Metadata

Assignees

Labels

non issueIssue is not a problem or requires changes

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions