Skip to content

Dynamic URL resolvers (BETA´ish)

Compare
Choose a tag to compare
@polterguy polterguy released this 22 Feb 09:29
· 6793 commits to master since this release

This release features something I am extremely enthused about, but which might be difficult to understand the importance of before I have videos and examples demonstrating it - However, basically, Magic now has the ability to dynamically resolve URLs, besides the default URL/CRUD routings that are resolved from magic/. Magic now supports.

  1. Static document resolving
  2. Dynamically executed Hyperlambda files

The rules are as follows, if you request a document using GET from any other folder but "magic/", and you have a "." in the URL, this will try to resolve the document from your "/files/static/" folder, allowing you to serve static documents as a part of your Magic server.

If you don't have a "." in the URL, and you request any document from any other root URL but "magic/", it will execute a dynamic Hyperlambda file that it assumes exists in the path of "/files/url-resolver.hl". This allow you to take complete control over the rendering of your documents, dynamically, and allows for all sorts of really cool scenarios.

If you request a "null" URL (default domain), and the file "/files/static/index.html" exists, this file will be served. If index.html does not exist, it will resolve using the above "url-resolver.hl" file.

Notice - None of the above rules will override any other types of controller endpoints your create, as long as you create a route for them, that are outside of existing routes, and not starting with "magic" etc. The Order of these routes are int.MaxValue, so they should not interfere with your own controller extensions.

Notice, these features are a little bit experimental, and should not be considered production ready (yet!).