試用revel-一個基於golang的web架構

來源:互聯網
上載者:User
這是一個建立於 的文章,其中的資訊可能已經有所發展或是發生改變。

首先下載revel

go get -u github.com/revel/cmd/revel

建立app

#假設GOPATH = /GOPATHcd /GOPATHrevel new coding.net/revel-example

以上命令建立了一個名為coding.net/revel-example的app

啟動app

revel run coding.net/revel-example

開啟瀏覽器,可以看到以及工作


螢幕快照 2017-09-08 上午11.25.03.png

此時看到的目錄結構是這樣的

ls -alhtotal 8.0Kdrwxr-xr-x 9 lamo  306  9  8 11:23 .drwxr-xr-x 3 lamo  102  9  8 11:23 ..-rw-r--r-- 1 lamo   27  9  8 11:23 .gitignore-rw-r--r-- 1 lamo 1.2K  9  8 11:23 README.mddrwxr-xr-x 7 lamo  238  9  8 11:24 appdrwxr-xr-x 4 lamo  136  9  8 11:23 confdrwxr-xr-x 3 lamo  102  9  8 11:23 messagesdrwxr-xr-x 6 lamo  204  9  8 11:23 publicdrwxr-xr-x 3 lamo  102  9  8 11:23 tests
  • app是主要的程式邏輯和資料結構,revel會自動監控這個目錄下面源檔案的修改,然後自動編譯。除此目錄之外的其他目錄,並不會自動編譯。

  • conf主要存放設定檔

  • messages主要存放i18n相關的檔案

  • public主要存放前端檔案

  • tests主要存放測試檔案

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.