Chapter 11. Webserver and Middleware

In this chapter, you will go through the basics of setting up a web server and exposing a JSON API. Dart ships with a built-in library named HTTPServer for serving content over the Hyper Text Transfer Protocol (HTTP). The HttpServer class acts as the foundation for implementing futures-based request and response handlers.

The HttpServer class is extremely extensible and is used as the foundation for many higher-level server libraries. One of those libraries is named Shelf and is a Google-supported project for composing web servers and other middleware. In Chapter 12, you’ll be taking a look at how to use Shelf to build out a RESTful API for your ticketing application.

Shelf

Shelf provides a consistent pattern ...

Get Write Web Apps with Dart: Develop and Design now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.