I must assume that your application has only one single resource, and
will never have any more than that? I don’t see how this could be
done in a truly RESTful way given that a major part of the REST URL is
to identify the “resource” that you want to access. In your case that
would be the Post resource (i.e. posts collection). Otherwise what
meaning would /5 have? The 5th item in a collection of what?
Another option would be to use a named route, but that isn’t really
P.S. The “posts” in the URL is not really the controller name. It is
the resource name/identifier. Read “GET: /posts/5” as GET the 5th
item from the posts collection of Post resources.