diff --git a/docs/en/API.md b/docs/en/API.md new file mode 100644 index 00000000..1409d882 --- /dev/null +++ b/docs/en/API.md @@ -0,0 +1,102 @@ +# Getting start with API application development +Go is very good for developing API applications which I think is the biggest strength compare to other dynamic languages. Beego provides powerful and quick setup tool for developing API applications, which gives you more focus on business logic. + + +## Quick setup +bee can setup a API application very quick by executing commands under any `$GOPATH/src`. + +`bee api beeapi` + +## Application directory structure + + ``` +├── conf +│ └── app.conf +├── controllers +│ └── default.go +├── models +│ └── object.go +└── main.go +``` + +## Source code explanation + +- app.conf has following configuration options for your API applications: + + - autorender = false // Disable auto-render since API applications don't need. + - copyrequestbody = true // RESTFul applications sends raw body instead of form, so we need to read body specifically. + +- main.go is for registering routers of RESTFul. + + beego.RESTRouter("/object", &controllers.ObejctController{}) + +Match rules as follows: + +
URL | HTTP Verb | Functionality | +
---|---|---|
/object | POST | Creating Objects | +
/object/objectId | GET | Retrieving Objects | +
/object/objectId | PUT | Updating Objects | +
/object | GET | Queries | +
/object/objectId | DELETE | Deleting Objects | +