Web服務器:QEDServer
QEDServer 是一個獨立的、自帶數據庫的Web服務器程序,配置起來非常簡單,而且可以跨平臺工作,但需要事先安裝Java 運行時環境。書中提到的“開發服務器”如無特殊說明,指的就是QEDServer。QEDServer可以為Web應用提供一個相對穩定的測試環境,并且可以方便地處理本地的Ajax請求。
QEDServer很容易啟動。Windows操作系統上的啟動文件是server.bat,如果是OS X或Linux操作系統,請運行./server.sh文件。運行后,系統會建立一個公共文件夾作為工作空間。只要在文件夾下創建一個 index.html文件,就可以使用地址http://localhost:8080/index.html在瀏覽器里訪問該頁面。
The API that's currently implemented is:
Products
GET
http://localhost:8080/products.json fetches a JSON feed of the productsGET
http://localhost:8080/products.xml fetches an XML feed of the productsGET
http://localhost:8080/product/1.json fetches the product with the ID of 1 as JSONGET
http://localhost:8080/product/1.xml fetches the product with the ID of 1 as XMLPOST
http://localhost:8080/products.json creates a new product. The fields need to be nested if you form-encode the data, so name your form fieldsproduct[name]
, etc. No nesting is required if you send the JSON in the request body.PUT
http://localhost:8080/products/1.json modifies the existing product with the id of 1. If you form-encode the data, you'll need to post data in the nested formatproduct[name]
, etc. If you send JSON in the request body, no nesting is required.DELETE
http://localhost:8080/products/1.json deletes the product with the ID of 1.GET
http://localhost:8080/products.rss fetches an RSS 2.0 feed of the products
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!