DEMOS / Smart Extensions Demo

Nitrogen's default routing handler allows you to use 'Smart Extensions.' A smart extension lets you provide an different entry point into a module that may or may not get pre- and post-processed in a standard way based on the extension provided to the filename. The most common smart extension might be appending a .json which might then return a .json encoded data structure, complete with the appropriate MIME-type set.

This demo uses Nitrogen's built-in JSON Smart Extension which, if the request has a .json extension, Nitrogen will call json_main(), which is expected to return an Erlang proplist. The proplist will automatically be converted to a JSON string and the MIME-type will be set to "application/json"

Click the link to the right to see it in action.

For more detail, see the Documentation for Smart Extensions

View Module Source
The following link will simply perform a redirect to: http://nitrogenproject.com/demos/smart_extensions.json
Check out the JSON Version of this page
Copyright © 2008-2024 Nitrogen Web Framework. Released under the MIT License.