Beginning with a simple example – Hello World

Let's take a look at a simple example of employing the HTTP server stack. This will help us understand the foundational building blocks before we dive into the more complex issue of exposing our game on the web.

If you followed the previous chapter, you should already have the HTTP package installed. If not, you know the drill—run pkg> add HTTP in Julia's REPL.

Now, somewhere on your computer, create a new file called hello.jl. Since this will be a simple piece of software contained in just one file, there's no need to define a module. Here is the full code, the whole eight lines, in all their glory. We'll go over them next:

using HTTP, Socketsconst HOST = ip"0.0.0.0"const PORT = 9999router = ...

Get Julia 1.0 Programming Complete Reference Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.