SlideShare ist ein Scribd-Unternehmen logo
1 von 51
Downloaden Sie, um offline zu lesen
Web development with Lua
Programming Language
Introducing Sailor, a web MVC framework in Lua
Etiene Dalcol
@etiene_d
@etiene_d
Sailor!

http://sailorproject.org
Web development with Lua @ GeeCON 2015 @etiene_d
Lua Ladies

http://lualadies.org
Web development with Lua @ GeeCON 2015 @etiene_d
Google Summer of Code
LabLua
Web development with Lua @ GeeCON 2015 @etiene_d
Web development with Lua @ GeeCON 2015 @etiene_d
Advantages
Web development with Lua @ GeeCON 2015 @etiene_d
Web development with Lua @ GeeCON 2015 @etiene_d
better reasons
• It looks cool
(I heard you could make games with it)
Web development with Lua @ GeeCON 2015 @etiene_d
better reasons
• 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)
Web development with Lua @ GeeCON 2015 @etiene_d
better reasons
• 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)
• It’s easy to learn
Web development with Lua @ GeeCON 2015 @etiene_d
?
?
?
?
?
?Web development with Lua @ GeeCON 2015 @etiene_d
Lua on the web
• Early stage
• cgilua ~ 1995
• Kepler Project ~ 2003
Web development with Lua @ GeeCON 2015 @etiene_d
“ 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
Web development with Lua @ GeeCON 2015 @etiene_d
Web development with Lua @ GeeCON 2015 @etiene_d
Web development with Lua @ GeeCON 2015 @etiene_d
Web development with Lua @etiene_d
Web development with Lua @ GeeCON 2015 @etiene_d
Web development with Lua @ GeeCON 2015 @etiene_d
Why?
Web development with Lua @ GeeCON 2015 @etiene_d
Web development with Lua @ GeeCON 2015 @etiene_d
Servers
• Apache: mod_lua
• Nginx: OpenResty
Web development with Lua @ GeeCON 2015 @etiene_d
Servers
Web development with Lua @ GeeCON 2015 @etiene_d
• Apache: mod_lua
• Nginx: OpenResty
Servers
• Apache: mod_lua
• Nginx: OpenResty
• Xavante
• Others
Web development with Lua @ GeeCON 2015 @etiene_d
Frameworks
• Orbit (2007)
Least known
No significant updates since 2010
MVC
Web development with Lua @ GeeCON 2015 @etiene_d
Frameworks
• Orbit (2007)
Least known
No significant updates since 2010
MVC
• Luvit (2011)
Most popular
Intense development
node.js port 2-4x faster
Web development with Lua @ GeeCON 2015 @etiene_d
Frameworks
• Lapis (2012)
Intense development
Moonscript and Lua
Very well documented
Templater
OpenResty only
Not MVC
Web development with Lua @ GeeCON 2015 @etiene_d
Frameworks
• Lapis (2012)
Intense development
Moonscript and Lua
Very well documented
Templater
OpenResty only
Not MVC
• Others
Complicated, abandoned, poorly documented, license
issues or I never heard about it...
Web development with Lua @ GeeCON 2015 @etiene_d
Sailor!
Web development with Lua @ GeeCON 2015 @etiene_d
Sailor!
Web development with Lua @ GeeCON 2015 @etiene_d
Sailor!
Web development with Lua @ GeeCON 2015 @etiene_d
Sailor!
0.1
(Venus)
0.2
(Mars)
Web development with Lua @ GeeCON 2015 @etiene_d
What exactly is Sailor?
• It’s an MVC web framework
• Completely written in Lua
• Compatible with Apache (mod_lua), Nginx (OpenResty),
Mongoose, Xavante and Lwan
• Compatible with Linux, Windows and Mac
• Compatible with different databases
• MIT License
• Pre alpha v0.2 (Mars)
• 0.3 (Jupiter) will be released TODAY!
Web development with Lua @ GeeCON 2015 @etiene_d
Web development with Lua @ GeeCON 2015 @etiene_d
What (else) is cool about Sailor?
• Routing and friendly URLs
• Session, cookies, include, redirect…
• Lua Pages parsing
• Mail sending
• Simple Object Relational-Mapping
• Validation (valua)
• Basic login and authentication modules
• Form generation
• Themes (Bootstrap integration out of the box)
• App generator (Linux and Mac only)
• Model and CRUD generator
Web development with Lua @ GeeCON 2015 @etiene_d
• Routing and friendly URLs
• Session, cookies, include, redirect…
• Lua Pages parsing
• Mail sending
• Simple Object Relational-Mapping
• Validation (valua)
• Basic login and authentication modules
• Form generation
• Themes (Bootstrap integration out of the box)
• App generator (Linux and Mac only)
• Model and CRUD generator
• Lua at client
What (else) is cool about Sailor?
Web development with Lua @ GeeCON 2015 @etiene_d
Not so great things
• It’s still in early development
• Things are changing fast
• It lacks features
• Documentation
Web development with Lua @ GeeCON 2015 @etiene_d
How to get Sailor!
$ luarocks install sailor
$ sailor_create ‘My App’ /var/www
$ cd /var/www/my_app
$ lua start-server.lua
Web development with Lua @ GeeCON 2015 @etiene_d
Web development with Lua @ GeeCON 2015 @etiene_d
How to get Sailor!
$ luarocks install sailor
$ sailor_create ‘My App’ /var/www
$ cd /var/www/my_app
$ lua start-server.lua
$ luarocks install luasql-mysqlOptional
Web development with Lua @ GeeCON 2015 @etiene_d
/conf
/controllers
/models
/pub
/runtime
/themes
/views
App structure
Web development with Lua @ GeeCON 2015 @etiene_d
Example!
-- /controllers/site.lua
local site = {}
function site.index(page)
local msg = “Hello World”
page:render(‘index’, { msg = msg } )
end
function site.notindex(page)
page:write(“I’m different!”)
end
return site
Web development with Lua @ GeeCON 2015 @etiene_d
Example!
<!-- /views/site/index.lp -->
<p>
A message from the server:
<?lua page:print(msg) ?>
<br/>
The message again:
<%= msg %> <!-- same thing as above —>
</p>
Web development with Lua @ GeeCON 2015 @etiene_d
Example!
Web development with Lua @ GeeCON 2015 @etiene_d
Example!
<?lua@server -- Code here runs on the server ?>
<?lua -- Same as above ?>
<?lua@client -- Runs at the client ?>
<?lua@both -- Runs at the server and the client ?>
<?lua@both
another_msg = “Another message”
?>
<?lua page:print(another_msg) ?>
<?lua@client
js.window.alert(another_msg)
?>
Web development with Lua @ GeeCON 2015 @etiene_d
Example!
Web development with Lua @ GeeCON 2015 @etiene_d
Example!
local user = {}
local v = require “valua” -- validation module
user.attributes = {
{ id = “safe” },
{ name = v:new().not_empty() }
}
user.db = {
key = ‘id’,
table = ‘users’
}
user.relations = {
posts = { -- u.posts
relation = “HAS_MANY”, model = “post”, attribute = “author_id”
}
}
return user
Web development with Lua @ GeeCON 2015 @etiene_d
Example!
-- /controllers/site.lua
local site = {}
function site.index(page)
local User = sailor.model(‘user’)
local u = User:new()
u.name = ‘Arnold’
local msg
if u:save() then
msg = ‘Success’
else
msg = table.unpack(u.errors)
end
local users = User:find_all()
page:render(‘index’, { msg = msg, users = users } )
end
return site
Web development with Lua @ GeeCON 2015 @etiene_d
sailorproject.org
github.com/Etiene/sailor
dalcol@etiene.net
@etiene_d
Example!
Web development with Lua @ GeeCON 2015 @etiene_d
sailorproject.org
github.com/Etiene/sailor
dalcol@etiene.net
@etiene_d

Weitere ähnliche Inhalte

Was ist angesagt?

Matt Gauger - Lamp vs. the world - MKE PHP Users Group - December 14, 2010
Matt Gauger - Lamp vs. the world - MKE PHP Users Group - December 14, 2010 Matt Gauger - Lamp vs. the world - MKE PHP Users Group - December 14, 2010
Matt Gauger - Lamp vs. the world - MKE PHP Users Group - December 14, 2010
Matt Gauger
 

Was ist angesagt? (20)

Master the New Core of Drupal 8 Now: with Symfony and Silex
Master the New Core of Drupal 8 Now: with Symfony and SilexMaster the New Core of Drupal 8 Now: with Symfony and Silex
Master the New Core of Drupal 8 Now: with Symfony and Silex
 
Laravel Forge: Hello World to Hello Production
Laravel Forge: Hello World to Hello ProductionLaravel Forge: Hello World to Hello Production
Laravel Forge: Hello World to Hello Production
 
Refactoring @ Mindvalley: Smells, Techniques and Patterns
Refactoring @ Mindvalley: Smells, Techniques and PatternsRefactoring @ Mindvalley: Smells, Techniques and Patterns
Refactoring @ Mindvalley: Smells, Techniques and Patterns
 
Matt Gauger - Lamp vs. the world - MKE PHP Users Group - December 14, 2010
Matt Gauger - Lamp vs. the world - MKE PHP Users Group - December 14, 2010 Matt Gauger - Lamp vs. the world - MKE PHP Users Group - December 14, 2010
Matt Gauger - Lamp vs. the world - MKE PHP Users Group - December 14, 2010
 
What's new and great in Rails 3 - Matt Gauger - Milwaukee Ruby Users Group De...
What's new and great in Rails 3 - Matt Gauger - Milwaukee Ruby Users Group De...What's new and great in Rails 3 - Matt Gauger - Milwaukee Ruby Users Group De...
What's new and great in Rails 3 - Matt Gauger - Milwaukee Ruby Users Group De...
 
React Development with the MERN Stack
React Development with the MERN StackReact Development with the MERN Stack
React Development with the MERN Stack
 
Desktop apps with node webkit
Desktop apps with node webkitDesktop apps with node webkit
Desktop apps with node webkit
 
Azkaban
AzkabanAzkaban
Azkaban
 
Grand Rapids PHP Meetup: Behavioral Driven Development with Behat
Grand Rapids PHP Meetup: Behavioral Driven Development with BehatGrand Rapids PHP Meetup: Behavioral Driven Development with Behat
Grand Rapids PHP Meetup: Behavioral Driven Development with Behat
 
php[world] 2015 Training - Laravel from the Ground Up
php[world] 2015 Training - Laravel from the Ground Upphp[world] 2015 Training - Laravel from the Ground Up
php[world] 2015 Training - Laravel from the Ground Up
 
Drupal 8: Huge wins, a Bigger Community, and why you (and I) will Love it
Drupal 8: Huge wins, a Bigger Community, and why you (and I) will Love itDrupal 8: Huge wins, a Bigger Community, and why you (and I) will Love it
Drupal 8: Huge wins, a Bigger Community, and why you (and I) will Love it
 
WordPress APIs
WordPress APIsWordPress APIs
WordPress APIs
 
Life Beyond Rails: Creating Cross Platform Ruby Apps
Life Beyond Rails: Creating Cross Platform Ruby AppsLife Beyond Rails: Creating Cross Platform Ruby Apps
Life Beyond Rails: Creating Cross Platform Ruby Apps
 
Wieldy remote apis with Kekkonen - ClojureD 2016
Wieldy remote apis with Kekkonen - ClojureD 2016Wieldy remote apis with Kekkonen - ClojureD 2016
Wieldy remote apis with Kekkonen - ClojureD 2016
 
Reactive Web-Applications @ LambdaDays
Reactive Web-Applications @ LambdaDaysReactive Web-Applications @ LambdaDays
Reactive Web-Applications @ LambdaDays
 
Creating a modern web application using Symfony API Platform Atlanta
Creating a modern web application using  Symfony API Platform AtlantaCreating a modern web application using  Symfony API Platform Atlanta
Creating a modern web application using Symfony API Platform Atlanta
 
遇見 Ruby on Rails
遇見 Ruby on Rails遇見 Ruby on Rails
遇見 Ruby on Rails
 
Ruby on Rails - An overview
Ruby on Rails -  An overviewRuby on Rails -  An overview
Ruby on Rails - An overview
 
Schema tools-and-trics-and-quick-intro-to-clojure-spec-22.6.2016
Schema tools-and-trics-and-quick-intro-to-clojure-spec-22.6.2016Schema tools-and-trics-and-quick-intro-to-clojure-spec-22.6.2016
Schema tools-and-trics-and-quick-intro-to-clojure-spec-22.6.2016
 
Gotta Persist 'Em All: Realm as Replacement for SQLite
Gotta Persist 'Em All: Realm as Replacement for SQLiteGotta Persist 'Em All: Realm as Replacement for SQLite
Gotta Persist 'Em All: Realm as Replacement for SQLite
 

Andere mochten auch

Andere mochten auch (10)

What's wrong with web
What's wrong with webWhat's wrong with web
What's wrong with web
 
Lua first steps
Lua first stepsLua first steps
Lua first steps
 
Lua and its Ecosystem
Lua and its EcosystemLua and its Ecosystem
Lua and its Ecosystem
 
Get started with Lua - Hackference 2016
Get started with Lua - Hackference 2016Get started with Lua - Hackference 2016
Get started with Lua - Hackference 2016
 
Lua as a business logic language in high load application
Lua as a business logic language in high load applicationLua as a business logic language in high load application
Lua as a business logic language in high load application
 
Hands on lua
Hands on luaHands on lua
Hands on lua
 
Lua vs python
Lua vs pythonLua vs python
Lua vs python
 
Lua: the world's most infuriating language
Lua: the world's most infuriating languageLua: the world's most infuriating language
Lua: the world's most infuriating language
 
The basics and design of lua table
The basics and design of lua tableThe basics and design of lua table
The basics and design of lua table
 
LuaConf 2016 - Becoming a Lua Powered Super Hero
LuaConf 2016 - Becoming a Lua Powered Super HeroLuaConf 2016 - Becoming a Lua Powered Super Hero
LuaConf 2016 - Becoming a Lua Powered Super Hero
 

Ähnlich wie Web development with Lua and Sailor @ GeeCon 2015

Netbeans65 Osum Slides
Netbeans65 Osum SlidesNetbeans65 Osum Slides
Netbeans65 Osum Slides
Abhishek Gupta
 

Ähnlich wie Web development with Lua and Sailor @ GeeCon 2015 (20)

Etiene Dalcol - Web development with Lua Programming Language - code.talks 2015
Etiene Dalcol - Web development with Lua Programming Language - code.talks 2015Etiene Dalcol - Web development with Lua Programming Language - code.talks 2015
Etiene Dalcol - Web development with Lua Programming Language - code.talks 2015
 
Building a Single Page Application with VueJS
Building a Single Page Application with VueJSBuilding a Single Page Application with VueJS
Building a Single Page Application with VueJS
 
Docs at Weaveworks: DX from open source to SaaS and beyond
Docs at Weaveworks: DX from open source to SaaS and beyondDocs at Weaveworks: DX from open source to SaaS and beyond
Docs at Weaveworks: DX from open source to SaaS and beyond
 
Flutter for web
Flutter for webFlutter for web
Flutter for web
 
From React to React Native - Things I wish I knew when I started
From React to React Native - Things I wish I knew when I startedFrom React to React Native - Things I wish I knew when I started
From React to React Native - Things I wish I knew when I started
 
Netbeans65 Osum Slides
Netbeans65 Osum SlidesNetbeans65 Osum Slides
Netbeans65 Osum Slides
 
Web development in Lua @ FOSDEM 2016
Web development in Lua @ FOSDEM 2016Web development in Lua @ FOSDEM 2016
Web development in Lua @ FOSDEM 2016
 
Everything about flutter web development
Everything about flutter web developmentEverything about flutter web development
Everything about flutter web development
 
Oracle JET and React Frontends.pptx
Oracle JET and React Frontends.pptxOracle JET and React Frontends.pptx
Oracle JET and React Frontends.pptx
 
Kendo ui web
Kendo ui webKendo ui web
Kendo ui web
 
Go for Operations
Go for OperationsGo for Operations
Go for Operations
 
playwrightmeetup-14jan2021-210114173639.pdf
playwrightmeetup-14jan2021-210114173639.pdfplaywrightmeetup-14jan2021-210114173639.pdf
playwrightmeetup-14jan2021-210114173639.pdf
 
Vincent biret azure functions and flow (ottawa)
Vincent biret azure functions and flow (ottawa)Vincent biret azure functions and flow (ottawa)
Vincent biret azure functions and flow (ottawa)
 
Vincent biret azure functions and flow (toronto)
Vincent biret azure functions and flow (toronto)Vincent biret azure functions and flow (toronto)
Vincent biret azure functions and flow (toronto)
 
Introduction to Eclipse Che / EclipseCon 2014
Introduction to Eclipse Che / EclipseCon 2014Introduction to Eclipse Che / EclipseCon 2014
Introduction to Eclipse Che / EclipseCon 2014
 
ASP.NET 5 Overview
ASP.NET 5 OverviewASP.NET 5 Overview
ASP.NET 5 Overview
 
Front End Development for Back End Developers - Devoxx UK 2017
 Front End Development for Back End Developers - Devoxx UK 2017 Front End Development for Back End Developers - Devoxx UK 2017
Front End Development for Back End Developers - Devoxx UK 2017
 
ASP.NET 5 Overview - Post Build 2015
ASP.NET 5 Overview - Post Build 2015ASP.NET 5 Overview - Post Build 2015
ASP.NET 5 Overview - Post Build 2015
 
Bringing swift to cloud
Bringing swift to cloudBringing swift to cloud
Bringing swift to cloud
 
ASP.NET 5 Overview: Post RTM
ASP.NET 5 Overview: Post RTMASP.NET 5 Overview: Post RTM
ASP.NET 5 Overview: Post RTM
 

Mehr von Etiene Dalcol

Mehr von Etiene Dalcol (7)

Making wearables with NodeMCU - FOSDEM 2017
Making wearables with NodeMCU - FOSDEM 2017Making wearables with NodeMCU - FOSDEM 2017
Making wearables with NodeMCU - FOSDEM 2017
 
Crescendo com Software livre e Lua
Crescendo com Software livre e LuaCrescendo com Software livre e Lua
Crescendo com Software livre e Lua
 
Get started with Lua programming
Get started with Lua programmingGet started with Lua programming
Get started with Lua programming
 
What I learned teaching programming to 150 beginners
What I learned teaching programming to 150 beginnersWhat I learned teaching programming to 150 beginners
What I learned teaching programming to 150 beginners
 
What I learned teaching programming to ~150 young women
What I learned teaching programming to ~150 young womenWhat I learned teaching programming to ~150 young women
What I learned teaching programming to ~150 young women
 
Humblelotto @HackJSY
Humblelotto @HackJSYHumblelotto @HackJSY
Humblelotto @HackJSY
 
Lua web development and Sailor @conc_at 2015
Lua web development and Sailor @conc_at 2015Lua web development and Sailor @conc_at 2015
Lua web development and Sailor @conc_at 2015
 

Kürzlich hochgeladen

%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 

Kürzlich hochgeladen (20)

%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 

Web development with Lua and Sailor @ GeeCon 2015

  • 1. Web development with Lua Programming Language Introducing Sailor, a web MVC framework in Lua Etiene Dalcol @etiene_d
  • 4. Lua Ladies
 http://lualadies.org Web development with Lua @ GeeCON 2015 @etiene_d
  • 5. Google Summer of Code LabLua Web development with Lua @ GeeCON 2015 @etiene_d
  • 6. Web development with Lua @ GeeCON 2015 @etiene_d
  • 7. Advantages Web development with Lua @ GeeCON 2015 @etiene_d
  • 8. Web development with Lua @ GeeCON 2015 @etiene_d
  • 9. better reasons • It looks cool (I heard you could make games with it) Web development with Lua @ GeeCON 2015 @etiene_d
  • 10. better reasons • 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) Web development with Lua @ GeeCON 2015 @etiene_d
  • 11. better reasons • 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) • It’s easy to learn Web development with Lua @ GeeCON 2015 @etiene_d
  • 12. ? ? ? ? ? ?Web development with Lua @ GeeCON 2015 @etiene_d
  • 13. Lua on the web • Early stage • cgilua ~ 1995 • Kepler Project ~ 2003 Web development with Lua @ GeeCON 2015 @etiene_d
  • 14. “ 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 Web development with Lua @ GeeCON 2015 @etiene_d
  • 15. Web development with Lua @ GeeCON 2015 @etiene_d
  • 16. Web development with Lua @ GeeCON 2015 @etiene_d
  • 17. Web development with Lua @etiene_d
  • 18. Web development with Lua @ GeeCON 2015 @etiene_d
  • 19. Web development with Lua @ GeeCON 2015 @etiene_d
  • 20. Why? Web development with Lua @ GeeCON 2015 @etiene_d
  • 21. Web development with Lua @ GeeCON 2015 @etiene_d
  • 22. Servers • Apache: mod_lua • Nginx: OpenResty Web development with Lua @ GeeCON 2015 @etiene_d
  • 23. Servers Web development with Lua @ GeeCON 2015 @etiene_d • Apache: mod_lua • Nginx: OpenResty
  • 24. Servers • Apache: mod_lua • Nginx: OpenResty • Xavante • Others Web development with Lua @ GeeCON 2015 @etiene_d
  • 25. Frameworks • Orbit (2007) Least known No significant updates since 2010 MVC Web development with Lua @ GeeCON 2015 @etiene_d
  • 26. Frameworks • Orbit (2007) Least known No significant updates since 2010 MVC • Luvit (2011) Most popular Intense development node.js port 2-4x faster Web development with Lua @ GeeCON 2015 @etiene_d
  • 27. Frameworks • Lapis (2012) Intense development Moonscript and Lua Very well documented Templater OpenResty only Not MVC Web development with Lua @ GeeCON 2015 @etiene_d
  • 28. Frameworks • Lapis (2012) Intense development Moonscript and Lua Very well documented Templater OpenResty only Not MVC • Others Complicated, abandoned, poorly documented, license issues or I never heard about it... Web development with Lua @ GeeCON 2015 @etiene_d
  • 29. Sailor! Web development with Lua @ GeeCON 2015 @etiene_d
  • 30. Sailor! Web development with Lua @ GeeCON 2015 @etiene_d
  • 31. Sailor! Web development with Lua @ GeeCON 2015 @etiene_d
  • 33. What exactly is Sailor? • It’s an MVC web framework • Completely written in Lua • Compatible with Apache (mod_lua), Nginx (OpenResty), Mongoose, Xavante and Lwan • Compatible with Linux, Windows and Mac • Compatible with different databases • MIT License • Pre alpha v0.2 (Mars) • 0.3 (Jupiter) will be released TODAY! Web development with Lua @ GeeCON 2015 @etiene_d
  • 34. Web development with Lua @ GeeCON 2015 @etiene_d
  • 35. What (else) is cool about Sailor? • Routing and friendly URLs • Session, cookies, include, redirect… • Lua Pages parsing • Mail sending • Simple Object Relational-Mapping • Validation (valua) • Basic login and authentication modules • Form generation • Themes (Bootstrap integration out of the box) • App generator (Linux and Mac only) • Model and CRUD generator Web development with Lua @ GeeCON 2015 @etiene_d
  • 36. • Routing and friendly URLs • Session, cookies, include, redirect… • Lua Pages parsing • Mail sending • Simple Object Relational-Mapping • Validation (valua) • Basic login and authentication modules • Form generation • Themes (Bootstrap integration out of the box) • App generator (Linux and Mac only) • Model and CRUD generator • Lua at client What (else) is cool about Sailor? Web development with Lua @ GeeCON 2015 @etiene_d
  • 37. Not so great things • It’s still in early development • Things are changing fast • It lacks features • Documentation Web development with Lua @ GeeCON 2015 @etiene_d
  • 38. How to get Sailor! $ luarocks install sailor $ sailor_create ‘My App’ /var/www $ cd /var/www/my_app $ lua start-server.lua Web development with Lua @ GeeCON 2015 @etiene_d
  • 39. Web development with Lua @ GeeCON 2015 @etiene_d
  • 40. How to get Sailor! $ luarocks install sailor $ sailor_create ‘My App’ /var/www $ cd /var/www/my_app $ lua start-server.lua $ luarocks install luasql-mysqlOptional Web development with Lua @ GeeCON 2015 @etiene_d
  • 42. Example! -- /controllers/site.lua local site = {} function site.index(page) local msg = “Hello World” page:render(‘index’, { msg = msg } ) end function site.notindex(page) page:write(“I’m different!”) end return site Web development with Lua @ GeeCON 2015 @etiene_d
  • 43. Example! <!-- /views/site/index.lp --> <p> A message from the server: <?lua page:print(msg) ?> <br/> The message again: <%= msg %> <!-- same thing as above —> </p> Web development with Lua @ GeeCON 2015 @etiene_d
  • 44. Example! Web development with Lua @ GeeCON 2015 @etiene_d
  • 45. Example! <?lua@server -- Code here runs on the server ?> <?lua -- Same as above ?> <?lua@client -- Runs at the client ?> <?lua@both -- Runs at the server and the client ?> <?lua@both another_msg = “Another message” ?> <?lua page:print(another_msg) ?> <?lua@client js.window.alert(another_msg) ?> Web development with Lua @ GeeCON 2015 @etiene_d
  • 46. Example! Web development with Lua @ GeeCON 2015 @etiene_d
  • 47. Example! local user = {} local v = require “valua” -- validation module user.attributes = { { id = “safe” }, { name = v:new().not_empty() } } user.db = { key = ‘id’, table = ‘users’ } user.relations = { posts = { -- u.posts relation = “HAS_MANY”, model = “post”, attribute = “author_id” } } return user Web development with Lua @ GeeCON 2015 @etiene_d
  • 48. Example! -- /controllers/site.lua local site = {} function site.index(page) local User = sailor.model(‘user’) local u = User:new() u.name = ‘Arnold’ local msg if u:save() then msg = ‘Success’ else msg = table.unpack(u.errors) end local users = User:find_all() page:render(‘index’, { msg = msg, users = users } ) end return site Web development with Lua @ GeeCON 2015 @etiene_d
  • 50. Example! Web development with Lua @ GeeCON 2015 @etiene_d