Google Code Prettify

2015年8月24日 星期一

PostgreSQL 9.3 HA Script

PostgreSQL 9.3 已經內建 Hot Standby 的機制

這時只要在加上 Linux Virtual Host, 就能達到 High Availability DB

寫了一個 shell script 在 git 上
https://github.com/yulinliu/postgres_ha

在加上網路、DB 的基本設定就可正常運作

2015年8月19日 星期三

RESTful Services 幾項重點

1. HTTP Method 對應Server處理方式
HTTP MethodData operateDescription
 POST Create Create a resource without id.
 GET Read Get a resource.
 PUT Update Update a resource or create a resource with id if not existed.
 DELETE Delete Delete a resource

2. Server Response Content Type
    JSON or XML or Text

3. 透過 HTTP Authorization 限制使用者存取資源的權限,也可用其它方式(ip、cookie)

4. response status code、error code 直接參考 http status code

5. REST 中的資源 一般是名詞 (podcasts, customers, user, accounts 等) 而不是動詞 (getPodcast, deleteUser 等)