account for :params and * wildcards in complex route match

master
garrettmills 4 years ago
parent 0e5a0a5a5c
commit 42e8b36df4
No known key found for this signature in database
GPG Key ID: 6ACD58D6ADACFC6E

@ -0,0 +1,6 @@
DATON_LOGGING_LEVEL=6
APP_NAME="My First Daton App!"
DB_USERNAME=garrettmills
DB_PASSWORD=garrettmills
DB_DATABASE=garrettmills

@ -26,8 +26,6 @@ export default class ApiController extends Controller {
return result
}
console.log('result', result)
// Otherwise, try to package the results as an API response
if ( Array.isArray(result) ) {
return this.make(JSONResponseFactory, api.many(result))

@ -10,6 +10,8 @@ export class ComplexRoute extends Route {
if ( base_parts.length !== incoming_parts.length ) return false
return base_parts.every((base, idx) => {
if ( base.startsWith(':') && base.length > 1 ) return true
else if ( base === '*' ) return true
return base.toLowerCase() === incoming_parts[idx].toLowerCase()
})
}

Loading…
Cancel
Save