Coder Social home page Coder Social logo

eja

a micro web server written in C and Lua that can serve dynamic content.

INSTALLING

If you are running any recent Debian or derivative it should be enough to run:

sudo apt-get install eja

If luarocks is available:

sudo luarocks install eja

Othewise:

git clone https://github.com/ubaldus/eja.git
cd eja
make
sudo make install

USAGE

The simplest way to use it would be:

eja --web-start 

this would serve the files contained in /var/eja/web on port 35248, thus if the file /var/eja/web/index.html exists its content would be available on your browser at http://localhost:35248/ .

If the file ends in .eja (index.eja) its content is generated dynamic:

web=...
web.data="Hello World!"
return web

or a little more complex with a file named sum.eja:

web=...
local a=ejaNumber(web.opt.a)
local b=ejaNumber(web.opt.b)
web.data=ejaSprintf("The sum is %d",a+b)
return web

in this case opening the url http://localhost:35248/sum.eja?a=3&b=4 would return

The sum is 7

SYNTAX

Apart from being able to execute plain text Lua scripts, eja has also its own special syntax, for this reason any file ending in .eja must be either a portable eja bytecode (--export) or must follow the below rules:

lua eja
and &&
or ||
not !
x=x+1 x+=1
x=x-1 x-=1
x=x*1 x*=1
x=x/1 x/=1

also () are mandatory and {} are used to replace then, do, end using the following syntax:

function sum(a,b) { return a+b; }

if (x==1) { print("one"); } elseif (x==2) { print("two"); } else { print("neither one nor two..."); }

for (i=1,10) { print(i); }

for (k,v in next,{1,2,3}) { print(k,v); }

i=0; while(i<10) { i+=1; print(i); }

i=0; repeat { i+=1; print(i); } until (i>=10);

eja's Projects

eja icon eja

eja micro web server

surf icon surf

an android browser implementing all known privacy features allowed by the empire...

tibula icon tibula

A Dynamic RDBMS with an Intuitive Web Interface and Flexible Customization.

tibula-lua icon tibula-lua

an eja/Lua framework for MySQL and Sqlite3 DBMS management, with a nice and intuitive web based GUI.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.