Clojure Web Development Essentials.
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 b...
Clasificación: | Libro Electrónico |
---|---|
Autor principal: | |
Formato: | Electrónico eBook |
Idioma: | Inglés |
Publicado: |
Packt Publishing,
2015.
|
Temas: | |
Acceso en línea: | Texto completo |
Tabla de Contenidos:
- Cover
- Copyright
- Credits
- About the Author
- About the Reviewers
- www.PacktPub.com
- Table of Contents
- Preface
- Chapter 1: Getting Started with Luminus
- Leiningen
- Using Leiningen
- Generating the application
- Getting help
- Dependencies of the app
- Luminus file structure
- util.clj
- session_manager.clj
- layout.clj
- middleware.clj
- routes/home.clj
- handler.clj
- repl.clj
- Summary
- Chapter 2: Ring and the Ring Server
- Understanding Ring in Clojure
- Request maps
- Response maps
- Handlers
- MiddlewareAdapters
- What is the Ring Server?
- hipstr.handler
- Initialization hooks
- Shutdown hooks
- App routes
- The application handler
- hipstr.repl
- Start-server
- Stop-server
- Get-handler
- Configuring and running the Ring Server
- Summary
- Chapter 3: Logging
- What is Timbre?
- What is an appender?
- Configuring a Timbre appender
- Timbre log levels
- Appender configuration keys
- Appender map
- Shared appender configuration
- Logging with Timbre
- Adding an appender
- Adding the rolling appender
- SummaryChapter 4: URL Routing and Template Rendering
- What is Compojure?
- Creating a Compojure route
- Using defroutes
- Anatomy of a route
- Defining the method
- Defining the URL
- Parameter destructuring
- Constructing the response
- Generating complex responses
- What is Selmer?
- Creating your first page
- Rendering a page
- Variables
- Filters
- Filter parameters
- Tags
- Template inheritance
- Editing the home page
- Serving the sign up form
- Creating the sign up page
- Summary
- Chapter 5: Handling Form InputHandling 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 fields
- Validating the format
- Validating length of values
- Validation predicates
- Making reusable validators
- Reporting errors to the user
- Summary
- Chapter 6: Testing in Clojure
- The necessity of testing
- Anatomy of a test
- Writing and running our first test
- Running tests
- Running tests automaticallyRefactoring tests
- Writing a high-level integration test
- Using ring.mock.request
- Summary
- Chapter 7: Getting Started with the Database
- Creating the database schema
- Maintaining the database schema
- Migratus
- Getting Migratus
- Configuring 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