freebsd-ports/www/rubygem-emk-sinatra-url-for/pkg-descr
Martin Wilke f81fe777cb sinatra-url-for constructs absolute paths and full URLs for
handlers in a Sinatra application. Assuming that your application
is running on example.com, and that it has been mapped to /myapp,
you should be able call url_for from within a handler as follows:

  url_for "/"            # Returns "/myapp/"
  url_for "/foo"         # Returns "/myapp/foo"
  url_for "/foo", :full  # Returns "http://example.com/myapp/foo"

WWW: http://github.com/emk/sinatra-url-for

PR:		ports/149359
Submitted by:	Eric Freeman <freebsdports at chillibear.com>
2010-08-09 05:36:05 +00:00

10 lines
462 B
Text

sinatra-url-for constructs absolute paths and full URLs for
handlers in a Sinatra application. Assuming that your application
is running on example.com, and that it has been mapped to /myapp,
you should be able call url_for from within a handler as follows:
url_for "/" # Returns "/myapp/"
url_for "/foo" # Returns "/myapp/foo"
url_for "/foo", :full # Returns "http://example.com/myapp/foo"
WWW: http://github.com/emk/sinatra-url-for