Book Image

Couchbase Essentials

Book Image

Couchbase Essentials

Overview of this book

Table of Contents (15 chapters)
Couchbase Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a task


At this point, we've designed a very simple to-do schema where our tasks are simply checklist items. Regardless of which web framework you are using, you'll need some sort of HTML form to collect the description and isComplete properties of the new tasks:

<html>
  <head>
    <title>Create a Task</title>
  </head>
  <body>
    <form action="tasks/create" method="POST">
      <div>Description: 
        <input type="text" name="description" />
      </div>
      <div>Complete: 
        <input type="checkbox" name="isComplete" />
      </div>
      </div><button type="submit" value="Save" />
    </form>
  </body>
</html>

The preceding HTML form collects these two properties and submits them to a server-side action named create. As an example of how you can respond to this form post, consider the following Python Flask snippet:

@app.route("/tasks/create", methods=["GET","POST...