URL Matching in Node module: raml-1-parser


#1

I am trying to write a middleware function for express that can validate a request/response against our RAML API definition. I’m using the official raml-1-parser from NPM. Does it have methods that will match parameterized URIs (for example /foo/{bar}) against actual URIs (for example /foo/something)? Or will I have to write those myself?


#2

I think you would need to do it by yourself.


#3

Is it the same for next parser version? (https://github.com/raml-org/raml-js-parser-2)


#4

Yes, as far as I know, there is nothing like that implemented into the parser.


#5

@jefflage: not sure if that’s the kind of answer you’re looking for but have you looked into Osprey? It supports both Express and RAML 1.0. It also uses something called osprey-router under the hood that does what you’re looking for.