1. Euphoria MVC framework - application routing working now

Forked from Euphoria MVC framework - template parser online

ghaberek said...

I've been alluding to this for a while, and the template parser is now pretty much complete, so I decided to get it posted to GitHub to track my continued progress.

Currently only the template parser is included, but I've added an example to the README to show how an application would look. Please try out the template parser, which can be used for any type of text files.

As always, if anyone would like to contribute, I have a lot of things that need to be done. The framework is being built in layers and I'm designing it to be as modular as possible to aid in collaboration.

This is the framework on which I will eventually build a new website for OpenEuphoria.org and hopefully many more websites after that.

https://github.com/OpenEuphoria/euphoria-mvc

Good news! I've gradually been making progress on the application routing for Euphoria MVC. The follow is an example of basic application that works just fine.

index.esp

include mvc/app.e 
include mvc/template.e 
include std/map.e 
 
constant APP_NAME = "My Application" 
 
function index( object request ) 
 
    map response = map:new() 
    map:put( response, "app_name", APP_NAME ) 
    map:put( response, "title", "Home" ) 
 
    return render_template( "index.html", response ) 
end function 
app:route( "/index", "index" ) 
app:route( "/", "index" ) 
 
function about( object request ) 
 
    map response = map:new() 
    map:put( response, "app_name", APP_NAME ) 
    map:put( response, "title", "About" ) 
 
    return render_template( "about.html", response ) 
end function 
app:route( "/about", "about" ) 
 
app:run() 

layout.html

<!DOCTYPE html> 
<html> 
<head> 
  <title>{{ title }} | {{ app_name }}</title> 
</head> 
<body> 
  <h1>{{ title }}</h1> 
 
  {% block content %} 
  {% end block %} 
 
</body> 
</html> 

index.html

{% extends layout.html %} 
{% block content %} 
 
  <p>This is the index page!</p> 
 
{% end block %} 

about.html

{% extends layout.html %} 
{% block content %} 
 
  <p>This is the about page!</p> 
 
{% end block %} 

-Greg

new topic     » topic index » view message » categorize

2. Re: Euphoria MVC framework - application routing working now

I just pushed some more updates to Euphoria MVC. I have some basic application examples I'm working on that are complete CRUD applications using EDS for storage. I'll publish those soon.

In the meantime, how does everyone feel about Docker? I'm thinking that might be the easiest way to package example code since there's so much setup involved in getting started with Euphoria MVC.

-Greg

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu