LoginSignup
10
11

More than 5 years have passed since last update.

go-json-rest を触ってみる

Last updated at Posted at 2014-12-06

go を用意する

インストール

Downloads - The Go Programming Language からダウンロード. インストールをしておく.

GOPATH を通す

.bashrc を編集.

~/.bashrc
export GOPATH=$HOME/golang

適用

source ~/.bashrc

ghq を用意する

go get で入れる.

go get github.com/motemen/ghq

peco を用意する

ghq 時代のディレクトリ移動を楽にするため.

go-json-rest を用意する

先ほど用意した ghq で落とす.

ghq get ant0ine/go-json-rest

動かしてみる

sample の main.go を落とす.

wget https://raw.githubusercontent.com/ant0ine/go-json-rest-examples/master/api-and-static/main.go

起動

go run main.go

curl してみる

curl -i http://127.0.0.1:8080/api/message
curl -i http://127.0.0.1:8080/static/main.go

OK.

References

10
11
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
10
11