restMappings error

I am configured in my server.json this restMappings


And I link correct Root Path and Service Mapping (I test service Server has been updated successfully
), but I receive in browser and PostMan message: “Oops! Not Found in commandbox”, why?


This component exists and is correct.

... cfcomponent rest="true"
        restpath="/userapp" ...

I am use version 6.0.0 the CommandBox, this project I am use only CommandBox without the coldbox

I haven’t used built in rest in a while, but don’t you need a wildcard (asterisk) on those mapping paths?

I try this, but I don’t understand this problem. (the asterisk had been placed in the message)
I try this, but all time return not found


I already removed the server and recreated it again and always the same behavior

My server.json


The reason the asterisk didn’t show up is because you didn’t use a proper code block, so your asterisk was taken as italics. Use three backticks before and after code blocks. I edited your message above to fix this.

If you’re using CommandBox 6, you probably need to modify the servlet pass predicate. By default, CommandBox 6 will only pass .cfc or .cfm URLs to the servlet, the rest get served as static files.

This page has an example of adding rest to the predicate.

server set web.servletPassPredicate=regex( '^/(.+?\\.cf[cm])(/.*)?$' ) or path-prefix-nocase( /rest/ )

Is perfect @bdw429s !
I set in may server.json and run correct.

... "web":{
        "servletPassPredicate":"regex( '^/(.+?\\.cf[cm])(/.*)?$' ) or path-prefix-nocase( /rest/ )",
        "http":{ ...

Tks a lot

1 Like