Skip to content

Commit

Permalink
chore: pr adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronauck committed Apr 16, 2018
1 parent 1404d8c commit 6db8c63
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@ const { getParamsAndQuery, isPattern, patternOpts } = require('../utils')

const METHODS = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS']

const methodFn = method => (path, handler) => {
if (!path) throw new Error('You need to set a valid path')
const methodFn = method => (givenPath, handler) => {
if (!givenPath) throw new Error('You need to set a valid path')
if (!handler) throw new Error('You need to set a valid handler')

return (req, res, namespace) => {
if (path === '/') {
path = '(/)'
}
const path = givenPath === '/' ? '(/)' : givenPath
const route = isPattern(path)
? path
: new UrlPattern(`${namespace}${path}`, patternOpts)
Expand Down

0 comments on commit 6db8c63

Please sign in to comment.