diff options
Diffstat (limited to 'docs/pages/1 - Cask: a Scala HTTP micro-framework.md')
-rw-r--r-- | docs/pages/1 - Cask: a Scala HTTP micro-framework.md | 116 |
1 files changed, 58 insertions, 58 deletions
diff --git a/docs/pages/1 - Cask: a Scala HTTP micro-framework.md b/docs/pages/1 - Cask: a Scala HTTP micro-framework.md index 25126e7..aa878c6 100644 --- a/docs/pages/1 - Cask: a Scala HTTP micro-framework.md +++ b/docs/pages/1 - Cask: a Scala HTTP micro-framework.md @@ -391,61 +391,61 @@ etc.. Those can be managed via the normal mechanism for [Serving Static Files](#serving-static-files). -<!--## TodoMVC Database Integration--> - -<!--$$$todoDb--> - -<!--This example demonstrates how to use Cask to write a TodoMVC API server that--> -<!--persists it's state in a database rather than in memory. We use the--> -<!--[Quill](http://getquill.io/) database access library to write a `@transactional`--> -<!--decorator that automatically opens one transaction per call to an endpoint,--> -<!--ensuring that database queries are properly committed on success or rolled-back--> -<!--on error. Note that because the default database connector propagates its--> -<!--transaction context in a thread-local, `@transactional` does not need to pass--> -<!--the `ctx` object into each endpoint as an additional parameter list, and so we--> -<!--simply leave it out.--> - -<!--While this example is specific to Quill, you can easily modify the--> -<!--`@transactional` decorator to make it <!--## TodoMVC Database Integration--> - -<!--$$$todoDb--> - -<!--This example demonstrates how to use Cask to write a TodoMVC API server that--> -<!--persists it's state in a database rather than in memory. We use the--> -<!--[Quill](http://getquill.io/) database access library to write a `@transactional`--> -<!--decorator that automatically opens one transaction per call to an endpoint,--> -<!--ensuring that database queries are properly committed on success or rolled-back--> -<!--on error. Note that because the default database connector propagates its--> -<!--transaction context in a thread-local, `@transactional` does not need to pass--> -<!--the `ctx` object into each endpoint as an additional parameter list, and so we--> -<!--simply leave it out.--> - -<!--While this example is specific to Quill, you can easily modify the--> -<!--`@transactional` decorator to make it work with whatever database access library--> -<!--you happen to be using. For libraries which need an implicit transaction, it can--> -<!--be passed into each endpoint function as an additional parameter list as--> -<!--described in--> -<!--[Extending Endpoints with Decorators](#extending-endpoints-with-decorators).--> -<!--work with whatever database access library--> -<!--you happen to be using. For libraries which need an implicit transaction, it can--> -<!--be passed into each endpoint function as an additional parameter list as--> -<!--described in--> -<!--[Extending Endpoints with Decorators](#extending-endpoints-with-decorators).--> - -<!--## TodoMVC Full Stack Web--> - - -<!--The following code snippet is the complete code for a full-stack TodoMVC--> -<!--implementation: including HTML generation for the web UI via--> -<!--[Scalatags](https://github.com/lihaoyi/scalatags), Javascript for the--> -<!--interactivity, static file serving, and database integration via--> -<!--[Quill](https://github.com/getquill/quill). While slightly long, this example--> -<!--should give you a tour of all the things you need to know to use Cask.--> - -<!--Note that this is a "boring" server-side-rendered webapp with Ajax interactions,--> -<!--without any complex front-end frameworks or libraries: it's purpose is to--> -<!--demonstrate a simple working web application of using Cask end-to-end, which you--> -<!--can build upon to create your own Cask web application architected however you--> -<!--would like.--> - -<!--$$$todo--> +## TodoMVC Database Integration + +$$$todoDb + +This example demonstrates how to use Cask to write a TodoMVC API server that +persists it's state in a database rather than in memory. We use the +[Quill](http://getquill.io/) database access library to write a `@transactional` +decorator that automatically opens one transaction per call to an endpoint, +ensuring that database queries are properly committed on success or rolled-back +on error. Note that because the default database connector propagates its +transaction context in a thread-local, `@transactional` does not need to pass +the `ctx` object into each endpoint as an additional parameter list, and so we +simply leave it out. + +While this example is specific to Quill, you can easily modify the +`@transactional` decorator to make it <!--## TodoMVC Database Integration + +$$$todoDb + +This example demonstrates how to use Cask to write a TodoMVC API server that +persists it's state in a database rather than in memory. We use the +[Quill](http://getquill.io/) database access library to write a `@transactional` +decorator that automatically opens one transaction per call to an endpoint, +ensuring that database queries are properly committed on success or rolled-back +on error. Note that because the default database connector propagates its +transaction context in a thread-local, `@transactional` does not need to pass +the `ctx` object into each endpoint as an additional parameter list, and so we +simply leave it out. + +While this example is specific to Quill, you can easily modify the +`@transactional` decorator to make it work with whatever database access library +you happen to be using. For libraries which need an implicit transaction, it can +be passed into each endpoint function as an additional parameter list as +described in +[Extending Endpoints with Decorators](#extending-endpoints-with-decorators). +work with whatever database access library +you happen to be using. For libraries which need an implicit transaction, it can +be passed into each endpoint function as an additional parameter list as +described in +[Extending Endpoints with Decorators](#extending-endpoints-with-decorators). + +## TodoMVC Full Stack Web + + +The following code snippet is the complete code for a full-stack TodoMVC +implementation: including HTML generation for the web UI via +[Scalatags](https://github.com/lihaoyi/scalatags), Javascript for the +interactivity, static file serving, and database integration via +[Quill](https://github.com/getquill/quill). While slightly long, this example +should give you a tour of all the things you need to know to use Cask. + +Note that this is a "boring" server-side-rendered webapp with Ajax interactions, +without any complex front-end frameworks or libraries: it's purpose is to +demonstrate a simple working web application of using Cask end-to-end, which you +can build upon to create your own Cask web application architected however you +would like. + +$$$todo |