Clojure Web Development Essentials Год: 2015 Автор: Ryan Baldwin Издательство: Packt Publishing ISBN: 978-1-78439-487-5 Язык: Английский Формат: PDF/EPUB Качество: Изначально компьютерное (eBook) Интерактивное оглавление: Да Количество страниц: 232 Описание: Functional programming enables developers to create and deploy applications quickly and easily. Using the Clojure programming language and the Leiningen build tool, this book teaches you how to leverage various Clojure libraries into the building blocks of a web-based application. We'll start by generating a new, fully runnable, baseline web application using the Leiningen Luminus template. From there we'll examine the different pieces that compose our application, and learn the basics of the underlying Ring framework. Subsequent chapters will focus on each technology and leverage those technologies to build additional functionality into our application. You'll learn how to validate user submitted data, authentication, account creation, how to interact with a database, and more. Finally, we'll create an environment configuration and deploy our app. By the end of this book you'll have created a full fledged application from start to finish, and you'll have the requisite skills to develop an efficient and robust web application.
Примеры страниц
Оглавление
Preface Chapter 1: Getting Started with Luminus Leiningen Using Leiningen Generating the application Getting help Dependencies of the app Luminus fie structure util.clj session_manager.clj layout.clj middleware.clj routes/home.clj handler.clj repl.clj Chapter 2: Ring and the Ring Server Understanding Ring in Clojure Request maps Response maps Handlers Middleware Adapters What is the Ring Server? hipstr.handler Initialization hooks Shutdown hooks App routes The application handler hipstr.repl Start-server Stop-server Get-handler Confiuring and running the Ring Server Chapter 3: Logging What is Timbre? What is an appender? Confiuring a Timbre appender Timbre log levels Appender confiuration keys Appender map Shared appender confiuration Logging with Timbre Adding an appender Adding the rolling appender Chapter 4: URL Routing and Template Rendering What is Compojure? Creating a Compojure route Using defroutes Anatomy of a route Defiing the method Defiing the URL Parameter destructuring Constructing the response Generating complex responses What is Selmer? Creating your fist page Rendering a page Variables Filters Filter parameters Tags Template inheritance Editing the home page Serving the signup form Creating the signup page Chapter 5: Handling Form Input Handling the form POST Validating the form POST The noir.validation namespace The Validateur library Adding the Validateur dependency Creating the user validation namespace Validating required filds Validating the format Validating length of values Validation predicates Making reusable validators Reporting errors to the user Chapter 6: Testing in Clojure The necessity of testing Anatomy of a test Writing and running our fist test Running tests Running tests automatically Refactoring tests Writing a high-level integration test Using ring.mock.request Chapter 7: Getting Started with the Database Creating the database schema Maintaining the database schema Migratus Getting Migratus Confiuring Migratus Creating the user table Dropping the user table Running the down scripts Migrating the database Running all migration scripts from Leiningen Running migrations programatically Adding migrations to the hipstr initialization Adding data to the database What is YeSQL? Getting YeSQL Adding a user to the database Inserting a user using SQL Inserting a user using Clojure Bringing it all together Adjusting the route Encrypting the password Chapter 8: Reading Data from the Database Creating the catalog Creating the artists table Seeding the artists table Creating the albums table Fetching albums from the database Writing the SQL query Creating the albums model Refactoring the connection Creating the recently added route Rendering the results An exercise! Chapter 9: Database Transactions Introduction to Database Transactions The ACID properties Importance of database transactions Implementing a transaction Transactions in Clojure Transactions in YeSQL Extending the application requirements in brief Creating the add artist/album form Creating the form Abstracting the form Creating the add artist/album endpoint Creating the Compojure route Creating the route helper function Validating the add artist/album form Expanding the album model Wrapping the whole thing in a transaction Using a transaction outside of this scope Chapter 10: Sessions and Cookies Sessions Setting up sessions Interacting with the session Restricted routes Restricting route access Accessing a restricted route Access rule as a function Access rule as a map Cookies Getting a cookie's value Setting a cookie's value Setting the cookie as a map Securing a cookie Deleting a cookie Extending the application: brief requirements Creating the login form Restricting the recently-added route Restricting the route Checking if the user is authenticated Defiing the access rule Authenticating the user Validating the credentials Handling the form POST Writing the "Remember Me" cookie Creating the logout route Chapter 11: Environment Confiuration and Deployment Environ Using environ Variable translations Setting and resolving environment confiurations Resolving environment confiuration Adjusting the database connection Creating the profies.clj fie Modifying the hipstr.models.connection namespace Deploying the hipstr application When to use an uberjar When to use an uberwar Deploying as a standalone Running the application behind Nginx Load balancing behind Nginx Appendix: Using Korma – a Clojure DSL for SQL Getting Korma The Quick Korma Crash Course Defie the database specifiation Korma entities Defiing the primary key Defiing relationships between entities Constructing SELECT queries Constructing INSERT queries Constructing UPDATE queries Constructing DELETE queries Using raw SQL Using transactions Port the models from YeSQL to Korma Porting hisptr.models.connection Porting hisptr.models.user-model Porting hipstr.models.album-model Index
До перезалития, торрент был скачан - 660раз.Торрент перезалит. Причина: добавлен Code.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum