/lol-bash-web-framework

A web framework written in bash. Please don't use this for anything. Work in progress...

Primary LanguageShell

lol-bash-web-framework

A web framework written in bash.

"Look at mah new framework, it does all the things!" yolo

source: nodejs reactions

###Requirementz Make sure netcat is installed.

###Start the internetz: ./server.sh

Visit: http://127.0.0.1:5000/home

####views.sh:

function homeView()
{
    local view=$(cat views/index.html)
    echo "$view"
}

function loginView()
{
    local view=$(cat views/login.html)
    echo "$view"
}

: '
# Implement a custom 404 view.
function 404View()
{
    echo "<h1>404 Not Found</h1>"
}
'

####urls.sh:

# URLs for routing to views
URLS=( ["/home"]=homeView )

####Host configuration: The default port is 5000, but can be changed in config.sh by editing the "PORT" variable:

PORT=5000

Work in progress... Ideas: custom status codes in the views, regex URL routing, templating (using awk + sed)....

######Warning: Don't actually use this for anything.