1.

How Do I Make The Trailing Slash Optional?

Answer»

Put a QUESTION MARK after it:

get '/foo/bar/?' do

"HELLO World"

END

The route matches "/foo/bar" and "/foo/bar/".

Put a question mark after it:

get '/foo/bar/?' do

"Hello World"

end

The route matches "/foo/bar" and "/foo/bar/".



Discussion

No Comment Found