manos: web apps for the lazy hacker

49
Manos Web apps for the lazy hacker Jérémie Laval http://blog.neteril.org http://twitter.com/jeremie_laval IRC garuma on #manos @ GIMPNet.org

Upload: jeremie-laval

Post on 16-May-2015

763 views

Category:

Technology


0 download

DESCRIPTION

Web development is a world of its own and the old-school hacker within us tends to be mystified by all these Macbook people talking about weird stuff like Rails, RESTful or NodeJS. But have no worries, this talk is for you (who always thought web development wasn't your cup of tea) and it will walk you through the steps of building a web application using Manos, the easy to use, high performance web application framework that stays out of your way and makes your life ridiculously simple. Forget about MVC, forget about ASP.NET, we are here to bring the fun of hacking into web development.

TRANSCRIPT

Page 1: Manos: web apps for the lazy hacker

ManosWeb apps for the lazy hacker

Jérémie Laval

http://blog.neteril.org

http://twitter.com/jeremie_laval

IRC garuma on #manos @ GIMPNet.org

Page 2: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

Background

� Doing HTML pages when I was young

� Sprinkled ugly PHP to make it dynamic

� <Alarm sound ringing />

� Moved on to C# / desktop coding

2 / 23

Page 3: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

Background

� Doing HTML pages when I was young

� Sprinkled ugly PHP to make it dynamic

� <Alarm sound ringing />

� Moved on to C# / desktop coding

2 / 23

Page 4: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

Background

� Doing HTML pages when I was young

� Sprinkled ugly PHP to make it dynamic

� <Alarm sound ringing />

� Moved on to C# / desktop coding

2 / 23

Page 5: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

Background

� Doing HTML pages when I was young

� Sprinkled ugly PHP to make it dynamic

� <Alarm sound ringing />

� Moved on to C# / desktop coding

2 / 23

Page 6: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

Background

� Doing HTML pages when I was young

� Sprinkled ugly PHP to make it dynamic

� <Alarm sound ringing />

� Moved on to C# / desktop coding

2 / 23

Page 7: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

Background

Disclaimer

3 / 23

Page 8: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

But wait, web has gotten better

� HTML 5, is that a title?

� CSS 3, non-designer best friend

� Javascript, more than animated cursor

What about .NET web application frameworks?

4 / 23

Page 9: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

But wait, web has gotten better

� HTML 5, is that a title?

� CSS 3, non-designer best friend

� Javascript, more than animated cursor

What about .NET web application frameworks?

4 / 23

Page 10: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

But wait, web has gotten better

� HTML 5, is that a title?

� CSS 3, non-designer best friend

� Javascript, more than animated cursor

What about .NET web application frameworks?

4 / 23

Page 11: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

But wait, web has gotten better

� HTML 5, is that a title?

� CSS 3, non-designer best friend

� Javascript, more than animated cursor

What about .NET web application frameworks?

4 / 23

Page 12: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

But wait, web has gotten better

� HTML 5, is that a title?

� CSS 3, non-designer best friend

� Javascript, more than animated cursor

What about .NET web application frameworks?

4 / 23

Page 13: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

Once upon a time...

Someone was wrong on the Internet

5 / 23

Page 14: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

They created

ASP

(Hint: VBScript as a default language)

6 / 23

Page 15: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

They created

ASP

(Hint: VBScript as a default language)

6 / 23

Page 16: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

They created

ASP

(Hint: VBScript as a default language)

6 / 23

Page 17: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

Hmmm...

7 / 23

Page 18: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

Tried to fix it

ASP

<asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="true"

IncludeStyleBlock="false" Orientation="Horizontal">

<Items>

<asp:MenuItem NavigateUrl="/Default.aspx" Text="Home" />

<asp:MenuItem NavigateUrl="/About.aspx" Text="About" />

<asp:MenuItem NavigateUrl="/Students.aspx" Text="Students">

<asp:MenuItem NavigateUrl="/StudentsAdd.aspx" Text="Add Students" />

</asp:MenuItem>

</Items>

</asp:Menu>

8 / 23

Page 19: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

Hmmm...

9 / 23

Page 20: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

Truth told

It's apparently better today

10 / 23

Page 21: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

In real (hacker) life

All too bloated

11 / 23

Page 22: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

What I wanted

� KISS (Keep It Simple Stupid)

� Let me code my way

� Integrate with existing stuff

What I really need is a lib that talks HTTP

But a bit more sophisticated than HttpListener

12 / 23

Page 23: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

What I wanted

� KISS (Keep It Simple Stupid)

� Let me code my way

� Integrate with existing stuff

What I really need is a lib that talks HTTP

But a bit more sophisticated than HttpListener

12 / 23

Page 24: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

What I wanted

� KISS (Keep It Simple Stupid)

� Let me code my way

� Integrate with existing stuff

What I really need is a lib that talks HTTP

But a bit more sophisticated than HttpListener

12 / 23

Page 25: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

What I wanted

� KISS (Keep It Simple Stupid)

� Let me code my way

� Integrate with existing stuff

What I really need is a lib that talks HTTP

But a bit more sophisticated than HttpListener

12 / 23

Page 26: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

What I wanted

� KISS (Keep It Simple Stupid)

� Let me code my way

� Integrate with existing stuff

What I really need is a lib that talks HTTP

But a bit more sophisticated than HttpListener

12 / 23

Page 27: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

What I wanted

� KISS (Keep It Simple Stupid)

� Let me code my way

� Integrate with existing stuff

What I really need is a lib that talks HTTP

But a bit more sophisticated than HttpListener

12 / 23

Page 28: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

But have no fear

A hero came

13 / 23

Page 29: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

Often pictured as

14 / 23

Page 30: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

But for real

( Jackson Harper, Manos creator and cartel manager during his free time )

15 / 23

Page 31: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

What's Manos in the end

� Standalone HTTP server

� Evented IO

� Parse and produce plain old HTTP

� Not tied to any content/template framework

� Code just with C# and a couple of attributes

16 / 23

Page 32: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

What's Manos in the end

� Standalone HTTP server

� Evented IO

� Parse and produce plain old HTTP

� Not tied to any content/template framework

� Code just with C# and a couple of attributes

16 / 23

Page 33: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

What's Manos in the end

� Standalone HTTP server

� Evented IO

� Parse and produce plain old HTTP

� Not tied to any content/template framework

� Code just with C# and a couple of attributes

16 / 23

Page 34: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

What's Manos in the end

� Standalone HTTP server

� Evented IO

� Parse and produce plain old HTTP

� Not tied to any content/template framework

� Code just with C# and a couple of attributes

16 / 23

Page 35: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

What's Manos in the end

� Standalone HTTP server

� Evented IO

� Parse and produce plain old HTTP

� Not tied to any content/template framework

� Code just with C# and a couple of attributes

16 / 23

Page 36: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

What's Manos in the end

� Standalone HTTP server

� Evented IO

� Parse and produce plain old HTTP

� Not tied to any content/template framework

� Code just with C# and a couple of attributes

16 / 23

Page 37: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

Bootstraping

How it all begun

$ manos -i apachai

initing: apachai

$ manos -b

COMPILING SOLUTION: '0' '/home/jeremie/mono/manostest/apachai'

/usr/local/lib/manos/Manos.dll

$ cd apachai

$ manos -s

Running apachai.apachai on port 8080.

17 / 23

Page 38: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

Setting up handlers

Simply getting a root page

[Route ("/")]

public void Index (IManosContext ctx)

{

Log.Info ("Woohoo, someone visited our website");

ctx.Response.SendFile (Path.Combine ("Templates", "base.html"));

ctx.Response.End ();

}

18 / 23

Page 39: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

Setting up handlers

Route handling delegated to external modules

public Apachai ()

{

Route ("/Content/", (staticContent = new StaticContentModule ("Content")));

Route ("/Pictures/", new PictureContentModule ());

AddPipe (new Manos.Util.AccessLogger ("access.log"));

}

19 / 23

Page 40: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

Giving back JSON

Nothing special really

[Route ("/visits")]

public void Visits (IManosContext ctx)

{

var cookie = ctx.Request.Cookies.Get ("foobar-apachai");

if (string.IsNullOrEmpty (cookie)) {

ctx.Response.StatusCode = 404;

ctx.Response.End ();

} else {

var counter = visits[cookie];

ctx.Response.End (string.Format ("{{ \"count\" : {0} }}", counter));

}

}

20 / 23

Page 41: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

What's Apachaï

Picture uploading for the rest of us

http://apch.fr

� Leverage TrollStation (Twitter) and Pinta (Effects)

� TagLib# for metadata handling

� JSON and AJAX driven

� Redis backed

� https://github.com/garuma/apachai

21 / 23

Page 42: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

What's Apachaï

Picture uploading for the rest of us

http://apch.fr

� Leverage TrollStation (Twitter) and Pinta (Effects)

� TagLib# for metadata handling

� JSON and AJAX driven

� Redis backed

� https://github.com/garuma/apachai

21 / 23

Page 43: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

What's Apachaï

Picture uploading for the rest of us

http://apch.fr

� Leverage TrollStation (Twitter) and Pinta (Effects)

� TagLib# for metadata handling

� JSON and AJAX driven

� Redis backed

� https://github.com/garuma/apachai

21 / 23

Page 44: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

What's Apachaï

Picture uploading for the rest of us

http://apch.fr

� Leverage TrollStation (Twitter) and Pinta (Effects)

� TagLib# for metadata handling

� JSON and AJAX driven

� Redis backed

� https://github.com/garuma/apachai

21 / 23

Page 45: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

What's Apachaï

Picture uploading for the rest of us

http://apch.fr

� Leverage TrollStation (Twitter) and Pinta (Effects)

� TagLib# for metadata handling

� JSON and AJAX driven

� Redis backed

� https://github.com/garuma/apachai

21 / 23

Page 46: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

What's Apachaï

Picture uploading for the rest of us

http://apch.fr

� Leverage TrollStation (Twitter) and Pinta (Effects)

� TagLib# for metadata handling

� JSON and AJAX driven

� Redis backed

� https://github.com/garuma/apachai

21 / 23

Page 47: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

Future driven processing

22 / 23

Page 48: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

Releasing season

� Manos 0.1.2 released!

� https://github.com/jacksonh/manos/tarball/v0.1.2

� Apachaï 1.0 released!

� https://github.com/garuma/apachai/tarball/1.0

23 / 23

Page 49: Manos: web apps for the lazy hacker

Personal context Manos Taking a tour: Apachaï Closing note

Releasing season

� Manos 0.1.2 released!

� https://github.com/jacksonh/manos/tarball/v0.1.2

� Apachaï 1.0 released!

� https://github.com/garuma/apachai/tarball/1.0

23 / 23