an ee.startup

what is genes.zone?

contact telegram twitter
genes:one
API

Routes

Yes, routing is cool, but did you try Views?

Everyone loves the widely-accpeted Model, View, and Controller-based architectural pattern and its expressive beautiful syntax which makes it object-oriented. Routing is one of the essential parts of this concept. Routing in modern frameworks allows you to route all your application requests to its appropriate controller. Most of the popular frameworks has a way of doing this.
Which can be re-thought. So we did.

URLs

Yes, you are used to the "/blabla/id" format, but don't you miss being free?

Global standards, REST, MVC, OOP, there are already accepted ways of doing things. Well, yeah, but, they can be modified.
URL or URI as they would like to call it, is baked into routing, and tied to controller it responds.
But, URL is a browseable web address, it does not have to be strictly in a format that your backend comprehends.
It can be any way you would like it to be. It does not need to be enforced.

Views

Well, actually, it all boils down to this...

Let's think for a second... Imagine you can create your routes, just in a json file, like editing a configuration...


  "views": {
    "Index": {
      "urls": {
        "en": "index"
      }
    },
    "Docs": {
      "urls": {
        "en": "documentation-and-all-the-other-beautiful-things"
      }
    },
    "Blog": {
      "urls": {
        "en": "updates-news-and-my-musings"
      }
    }
  }


          

And then let's imagine again, that you can create a function for these json keys...


  "Index" => function () {
    // Every wonderful thing that you want to insert into your home page..
    g::run("ui.LoadViewHtml");
  },
  "Docs" => function () {
      // Documentation does not have to be boring, it needs to be explanatory..
      g::run("ui.LoadViewHtml");
  },
  "Blog" => function () {
      // World needs another blog, so I have done my best to provide one..
      g::run("ui.LoadViewHtml");
  },


          

Beautiful, just beautiful... But wait it's not done. How about your global audience?

Internationalization

Of course, you can use your mother tongue too...

We noticed that you noticed that there is an "en" key within the "urls" key.. Yes that is the spot.


  "views": {
    "Index": {
      "urls": {
        "en": "index",
        "ee": "tere-tulemast"
      }
    },
    "Docs": {
      "urls": {
        "en": "documentation-and-all-the-other-beautiful-things",
        "ee": "ma-ei-raagi-eesti-keelt"
      }
    },
    "Blog": {
      "urls": {
        "en": "updates-news-and-my-musings",
        "ee": "meeldiv-tutvuda"
      }
    }
  }


          

So now, you can do other things, depending on your language, when you call your function, simple as that...


  "Index" => function () {
    // Every wonderful thing that you want to insert into your home page..
    $lang = g::get("op.meta.url.lang");
    if($lang === "ee") {
      // Show a disclaimer alert on top to confess that you don't speak a word of the language. 
    }
    else if ($lang === "en") {
      // Show them your TOEFL score! Good for you!
    }
    g::run("ui.LoadViewHtml");
  },
  "Docs" => function () {
      // Documentation does not have to be boring, it needs to be explanatory..
      g::run("ui.LoadViewHtml");
  },
  "Blog" => function () {
      // World needs another blog, so I have done my best to provide one..
      g::run("ui.LoadViewHtml");
  },


          

Well, we also noticed that you noticed that "urls" key is "plural". Well, that's whole another subject...


  "views": {
    "Index": {
      "urls": {
        "en": ["index", "default", "my-wonderful-homepage"],
        "ee": "tere-tulemast"
      }
    }
  ...


          
×

Contact NodOnce : Say Something!