Roundcrisis

About Contact me Presentations rss feed  rss

Manos de Mono - Quick overview

13 Oct 2010

I heard about this new web framework the other day, the code its available on github/jacksonh/manos the main interesting thing I heard about it were:

At this point, I wanted to see some code, I went to the example on github and I was pleasantly surprised

[sourcecode language=”csharp” padlinenumbers=”true” collapse=”false”] // // A mango application is made of MangoModules and MangoApps // There really isn’t any difference between a Module and an App // except that the server will load the MangoApp first. A mango // application can only have one MangoApp, but as many MangoModules // as you want. // public class MangoProject : MangoApp {

	public MangoProject ()
	{
		//
		// Routing can be done by using the Get/Head/Post/Put/Delete/Trace
		// methods. They take a regular expression and either a method
		// or another module to hand off processing to.
		//
		// The regular expressions come after the method/module, because
		// Mango uses params to allow you to easily register multiple
		// regexs to the same handler
		//
		Get (Home, "Home");

		//
		// The Route method will hand off all HTTP methods to the supplied
		// method or module
		//
		Route (new DocsModule (), "Docs/");
	}

	//
	// Handlers can be registered with attributes too
	//

	[Get ("About")]
	public static void About (MangoContext ctx)
	{
		//
		// Templates use property lookup, so you can pass in
		// a strongly typed object, or you can use an anonymous
		// type.
		//
		RenderTemplate (ctx, "about.html", new {
			Title = "About",
			Message = "Hey, I am the about page.",
		});
	}

	public static void Home (MangoContext ctx)
	{
		RenderTemplate (ctx, "home.html", new {
			Title = "Home",
			Message = "Welcome to the Mango-Project."
		});
	}
} [/sourcecode]

Will have to do some more research on it

Categories:   unit-testing   web-development

Want to discuss this post? the best place right now for me is mastodon, please message me @roundcrisis@types.pl with your comment or question.