bashd
1.0.0

プロジェクトをクローンします
git clone https://github.com/AlexGustafsson/bashd
フォルダーに移動します
cd bashd
サーバーを起動します
./bashd
クイックスタート
特徴
使用法
貢献
よくある質問
ルートを定義します
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ページの処理
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 :機能しますか? A :はい。
Q :安全ですか? A :いいえ。
Q :冗談ですか? A :主に。
プロジェクトの支援は大歓迎です。疑わしい場合は、問題を投稿してください。