Clone the project
git clone https://github.com/AlexGustafsson/bashd
Navigate to the folder
cd bashd
Start the server
./bashd
Quickstart
Features
Usage
Contributing
FAQ
- 🔥 Not incredibly slow (300ms for a response)
- 🛣 Routing
- 📭 Easy-to-use POST support
- 🔒 Security by obscurity. Who's expecting a Bash web server?
Defining a route
route get / homePage
# Special 404 route - handles all 404s
route get 404 notFoundPage
# POST a message to the echo page to hear it back louder!
route post /echo echoPage
Handling pages
function homePage {
startResponse
cat << EOF
<html>
<head></head>
<body>
<h1>Hello, World!</h1>
</body>
</html>
EOF
}
function notFoundPage {
setResponseCode "404"
startResponse
cat << EOF
<html>
<head></head>
<body>
<h1>Cannot find $HTTP_METHOD $HTTP_PATH</h1>
</body>
</html>
EOF
}
function echoPage {
startResponse
cat << EOF
<html>
<head></head>
<body>
<h1>${HTTP_BODY_MESSAGE^^}</h1>
</body>
</html>
EOF
}
Q: Does it work? A: Yes.
Q: Is it safe? A: No.
Q: Is it a joke? A: Mostly.
Any help with the project is more than welcome. When in doubt, post an issue.