summaryrefslogtreecommitdiff
path: root/examples/externalable/README.md
diff options
context:
space:
mode:
authorSteve Manuel <nilslice@gmail.com>2017-03-09 11:53:58 -0800
committerSteve Manuel <nilslice@gmail.com>2017-03-09 11:53:58 -0800
commitd5b7c62043b1ef5b284b094f4663c17e5abd33c7 (patch)
treeb834fd0ef50c35d9ad910bc80d1a15c1373faace /examples/externalable/README.md
parent242c6212d173dae622b374d38a4fa2a640a4f4c6 (diff)
adding api.Externalable example, with Approve/AutoApprove and hooks
Diffstat (limited to 'examples/externalable/README.md')
-rw-r--r--examples/externalable/README.md30
1 files changed, 30 insertions, 0 deletions
diff --git a/examples/externalable/README.md b/examples/externalable/README.md
new file mode 100644
index 0000000..5cd22a9
--- /dev/null
+++ b/examples/externalable/README.md
@@ -0,0 +1,30 @@
+# Externalable
+
+This example shows how to enable outside clients to submit content to your CMS.
+All content submitted must be done through a POST request encoded as `multipart/form-data`
+
+## Song example
+Imagine an app that lets users add Spotif music to a global playlist, and you need them
+to supply songs in the format:
+```go
+type Song struct {
+ item.Item
+
+ Title string `json:"title"`
+ Artist string `json:"artist"`
+ Rating int `json:"rating"`
+ Opinion string `json:"opinion"`
+ SpotifyURL string `json:"spotify_url"`
+}
+```
+
+See the file `content/song.go` and read the comments to understand the various
+methods needed to satify required interfaces for this kind of activity.
+
+### Overview
+1. Implement `api.Externalable` with the `Accept(http.ResponseWriter, *http.Request)` method to allow outside POST requests
+2. Implement `editor.Mergeable` with the `Approve(http.ResponseWriter, *http.Request)` method so you can control the Approval / Rejection of submitted content OR
+3. Implement `api.Trustable` with the `AutoApprove(http.ResponseWriter, *http.Request)` method to bypass `Approve` and auto-approve and publish submitted content
+
+There are various validation and request checks shown in this example as well.
+Please feel free to modify and submit a PR for updates or bug fixes! \ No newline at end of file