+ All Categories
Home > Software > Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)

Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)

Date post: 21-Jun-2015
Category:
Upload: etiene-dalcol
View: 411 times
Download: 0 times
Share this document with a friend
Description:
Lua's use in web tools, despite its great potential, is not yet widespread. Having had experience as a web programmer, and aiming to learn more about this language, I started a marathon that produced an MVC framework completely written in Lua, called Sailor. This talk presents the beginnings of Sailor, a comparison with other existing tools, the current stage of Sailor's development today and intends to start a debate on what we can do to spread the idea of using Lua more in web development. See sailorproject.org and sailor at github.com.
Popular Tags:
30
Sailor A web MVC framework in Lua Etiene Dalcol
Transcript
Page 1: Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)

SailorA web MVC framework in Lua

Etiene Dalcol

Page 2: Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)

Etiene Dalcol

Email: [email protected]: @etiene_d

2

Page 3: Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)

Why I started learning

➔ It looks cool (I heard you could make games with it)

3

Page 4: Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)

Why I started learning

➔ It looks cool (I heard you could make games with it)➔ It’s made in my home country (In my university to be more precise)

3

Page 5: Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)

Why I started learning

➔ It looks cool (I heard you could make games with it)➔ It’s made in my home country (In my university to be more precise)➔ I could brag about it later

3

Page 6: Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)

Why I started coding Sailor

➔ I needed something real!

4

Page 7: Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)

Why I started coding Sailor

➔ I needed something real!➔ I could use my previous knowledge to go

faster

4

Page 8: Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)

Sailor!

5

Page 9: Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)

Sailor!

5

Page 10: Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)

Sailor!

5

Page 11: Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)

And what exactly is Sailor

➔ It’s an MVC web framework➔ Completely written in Lua➔ Compatible with Apache (mod_lua), Nginx

(OpenResty) and Mongoose ➔ Compatible with Linux, Windows and Mac➔ MIT License➔ Pre alpha v0.2 - Mars

6

Page 12: Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)

Yes, the version names are inspired by Sailor Moon

7

Page 13: Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)

What does it do

➔ Simple URL routing➔ Session, cookies, include, redirect…➔ Lua Pages parsing from cgilua➔ Mail sending➔ Simple Objet Relational-Mapping (MySQL,

PostgreSQL…)➔ Input Validation (valua)➔ Basic login and authentication

8

Page 14: Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)

What does it do

➔ Form generation➔ Twitter bootstrap integration➔ App generator (Linux and Mac only)

9

Page 15: Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)

What does it do

➔ Form generation➔ Twitter bootstrap integration➔ App generator (Linux and Mac only)

Premium feature!➔ Lua at client

9

Page 16: Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)

What’s bad about it

➔ Early development➔ Things are changing fast➔ It still lacks features➔ Documentation

10

Page 17: Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)

Server-side languages

Client-side languages

11

Page 18: Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)

Content Management Systems

12

Page 19: Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)

Web servers

13

Page 20: Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)

“ I have myself developed Web sites with pure C++, Java, C#, PHP, and Python. The easiest way to go was definitely Python. If the libraries existed, Lua would be not quite as easy to use as Python, but probably quite a bit more efficient; I think it would become my first choice... if the libraries existed.” Michael Gogins

“ Recently there was some discussion about mod_lua on the Apache developers mailing list. I mentioned there that I feel Lua could replace PHP as the number one web scripting language if mod_lua were stable (i.e. not still in beta) and it were implemented well (not making some of PHP's mistakes such as putting everything in the global scope with no consistent naming or parameter schemes). I've wanted to use Lua for all the things I currently use PHP for ever since I discovered it.” Rena

14

Page 21: Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)

15

Page 22: Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)

More Lua for Web

➔ ~ Early stage

➔ cgilua (1995)➔ Kepler Project (2003)

16

Page 23: Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)

Other frameworks

➔ Orbit (2007)◆ Least known◆ No significant updates since 2010◆ Closest to Sailor’s concept

➔ Luvit (2011)◆ Most popular◆ Intense development◆ node.js port 2-4x faster

17

Page 24: Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)

Other frameworks

➔ Lapis (2012)◆ Intense development◆ Moonscript and Lua◆ Very well documented◆ OpenResty only◆ Templater◆ Not MVC

➔ Others◆ Complicated, abandoned, poorly documented,

license issues or I never heard about it...18

Page 25: Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)

Back to Sailor!

Getting it:

➔ LuaRocks or Github

19

Page 26: Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)

A Setup Example

➔ Install Lua➔ Install LuaRocks➔ Install database server (MySQL for example)➔ Install apache2 (>=2.4.7)➔ Create app!

20

Page 27: Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)

App Structure

/conf /controllers /layouts /models /pub /runtime /views

21

Page 28: Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)

site.lua

index.lp

22

Page 29: Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)

site.lua

index.lp

22

Page 30: Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)

Etiene Dalcolsailorproject.org

github.com/Etiene/[email protected]

twitter.com/etiene_d 23


Recommended