euphoria-mvc - app:run()
- Posted by jmduro Jan 06, 2021
- 822 views
When I'm trying euphoria-mvc with the development server ( server:start() ), I enter a route in the browser to see it in action.
When using following example (index.esp) with an Apache server in CGI mode ( app:run() ), I don't know what to do:
- to run the script in CGI mode I must address the script ( http://localhost/index.esp ), but I get an error 404.
- to access a route, I would have to address the route ( http://localhost/ ) but there is no route since the script has not been run.
Did I miss something ?
include mvc/app.e include mvc/server.e include mvc/template.e include mvc/logger.e include std/map.e function index( object request ) object response = map:new() map:put( response, "title", "My First App" ) map:put( response, "message", "Hello, world!" ) return render_template( "index.html", response ) end function app:route( "/", "index" ) -- "/" is the URL path, "index" is the name of the route -- route() will find the matching routine automatically set_log_output({ "!debug.log" }) -- overwrite debug.log each time set_log_level( LOG_DEBUG ) --server:start("0.0.0.0", 8080) app:run()
Jean-Marc