Sample Presentation

22 April 2014

Michael Lore

What is served?

served is a simple web server written in Go. It serves three kinds of content:

In addition to a great HTTP library, the Go authors provided some very useful libraries and code for blogging:

served puts a framework around these that allows you to configure servers that respond on different ports, hosts, and paths.

The configuration file

served's configuration file is a simple JSON file. Servers can be defined to listen on unique addresses. Each server can support responding to multiple host names.

Setting up a static site

Static sites need to specify a web root ending in "/" and a folder on disk:

                    "VDirs": [
                        { "Root": "/", "Folder": "/Users/michael/web/skyegg" },
                        { "Root": "/gopher/static/", "Folder": "/Users/michael/gocode/src/" }

Setting up a blog

In addition to the settings for a static site, blogs need to specify the number of articles to show on the home page,
the number of articles to list in the atom feed, and the feed title:

                    "Blogs": [
                        { "Root": "/gopher/", "Folder": "/Users/michael/gocode/src/", "HomeArticles": 5, "FeedArticles": 10, "FeedTitle": "served" }

The blog folder must have a template folder (for the go templates for the site) and a content folder (for articles, slides, and other content). Additionally, there should be a static folder configured as a VDir to hold some web content needed by the templates. Sames of these are available on GitHub.

Enabling "play" mode

If you enable play mode, users can compile and execute Go code from the web page! This should probably not be enabled on a public web site, however. served has not been particularly hardened.

                    "PlayEnabled": true,
                    "NativeClient": false


When a blog is configured, you can view articles and slide shows in an alternate format by using the "slides" URL:

Present markup

The following sections show some of the things you can do with present format.

Preformatted text

Simply indent to get preformatted text.

This is preformatted.

Showing code from another file

.code puzz.go /^const/,/^\)/
const (
    K = "GOTHACK"


- bullets
- more bullets


.image gopher640.jpg 400 400

Play Code

.play puzz.go
package main

import (

const (
    K = "GOTHACK"

func main() {
    for _, c := range C {
        fmt.Printf("%c", A1[strings.Index(A2, string(c))])

Use an iframe

.iframe puzz.go 500 500


.link Yahoo!
Another format is [[][Google]]

Another format is Google

Thank you