In the cloud age, web technologies are more important than ever. The vibe.d framework enables you to use the D programming language for a wide range of web-related tasks. The D programming language allows elegant solutions for common problems, while native compilation produces fast binaries. The vibe.d framework takes advantage of these language features. Together with the innovative use of fibers, the applications that you build are scalable and have a very quick response time.
This book will explain everything you need to know about the vibe.d framework in order to successfully build and run web applications.
Chapter 1, Getting Started with Your First Web Application, explains how to set up and use your development environment. At the end of this chapter, you will have already created your first web application.
Chapter 2, Using Templates for Your Web Pages, covers the Diet template engine. You will learn all about templates—from creating simple static templates to using D code in templates.
Chapter 3, Get Interactive – Forms and Flow Control, brings web forms to your application and introduces route matching.
Chapter 4, Easy Forms with the Web Framework, discusses how to validate user input.
Chapter 5, Accessing a Database, shows how to use a database in an application using a variety of SQL and NoSQL bases.
Chapter 6, Using the REST Interface, teaches you about REST services. You will learn how to provide and consume a generated REST service. You will also study how to interface with an existing REST service.
Chapter 7, The vibe.d Internals, introduces you to the fiber-based pseudo-blocking programming model that is the base for vibe.d.
Chapter 8, Using vibe.d with a GUI Client, applies the vibe.d programming model to a graphical UI application.
Chapter 9, Power Your Application with vibe.d Extensions, shows you what other developers have already implemented with vibe.d and how to publish your application.
You need a Linux, Windows, or Mac PC that is capable of running the DMD D compiler and the DUB package manager. Both software packages are available at http://code.dlang.org/. The vibe.d framework requires an SSL
library and the libevent
library to be installed. The various sources are described in Chapter 1, Getting Started with Your First Web Application.
In order to compile the examples, you need an Internet connection in order to allow the automatic download of dependent software.
For the example in Chapter 5, Accessing a Database, you need Redis 3.x (available at http://redis.io/), MongoDB 3.x (available at http://ww.mongodb.org/), and MySQL 5.x (available at http://dev.mysql.com/downloads/). Chapter 6, Using the REST Interface, uses CouchDB (available at http://couchdb.apache.org/) and Chapter 9, Power Your Application with vibe.d Extensions, uses Cassandra (available at http://cassandra.apache.org/).
Whether you are new to the world of D, already have developed applications in D, or you want to leverage the power of D for web development, then this book is ideal for you. Basic knowledge of core web technologies, such as HTML 5, is helpful; however, it not necessary. This book explains the complex details to speed your web development.
In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "You also need to install openssl
and libevent
, which are used by vibe.d."
A block of code is set as follows:
name "hello" description "A simple vibe.d server application." copyright "Copyright © 2015, <yourid>" authors "<yourid>" dependency "vibe-d" version="~>0.7.23" versions "VibeDefaultMain"
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
body
block header
header Header
block navigation
include navigation
block content
block footer
footer Footer
Any command-line input or output is written as follows:
$ tar xvzf dub-0.9.24.tar.gz $ cd dub-0.9.24 $ ./build.sh
New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Click on the Unlock button to unlock the window and change the account type to Administrator."
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.
To send us general feedback, simply e-mail <[email protected]>
, and mention the book's title in the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from https://www.packtpub.com/sites/default/files/downloads/8890OS_ColouredImages.pdf.
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.
To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.
Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <[email protected]>
with a link to the suspected pirated material.
We appreciate your help in protecting our authors and our ability to bring you valuable content.
If you have a problem with any aspect of this book, you can contact us at <[email protected]>
, and we will do our best to address the problem.