LoginSignup
0
0

皆さん、こんにちは!
今回はStackProgrammingCommunityの初投稿記事です。
今話題のディストリビューションStackServerを解説します。

StackServerとは?

Stackプログラミング言語のWebサーバーサイド開発向けディストリビューションです。扱いやすくエレガントなStackを強みを生かしてWebサーバーを構築する事が出来ます。

インストール

早速インストールしていきましょう
以下のコマンドをターミナルに打ち込みます。

git clone https://github.com/stack-community/stack-server.git
cargo install --path ./stack-server

確認のため以下のコマンドを叩きます。

stack-server

これで以下のようなStackServerの対話環境が開いたらインストール成功です!

image.png

Hello, world!

リポジトリのexampleフォルダ内に公式がサンプルコードを用意してくれてますが初心者には難しいので、自力で「Hello, world」を表示するサーバーを立てます。

hello.stk
(127.0.0.1:8000) [
    [[(GET /)] (
        (text/html)
        (Hello, world!)
    )]
] start-server

このコードを以下のコマンドで実行してみましょう。

stack-server ./hello.stk

すると以下のように表示されます。そのURLにアクセスしてみましょう。

image.png

FOOOOOOOOOOOOOOOOO↑↑↑

image.png

成功です!おめでとうございます。

まとめ

ここまで読んでくれてありがとうございました。しかし、これはStackServerのほんの序章にすぎません。さらなるステップアップには、公式のサンプルコードと睨めっこしたり動かしたりしてみてください。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0