Web服务器:QEDServer
jopen
10年前
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