Snapshots
You can take a snapshot of your server and statically generate its resources.
This is achieved by launching and crawling the web server locally using the cli.

This technique is also known as SSG, Static Site Generation.
Note
Although the comparison to SSG makes sense, frizzante snapshots are a bit more powerful.

The final snapshot itself contains static content, but the local web server used to generate the snapshot can be seeded with dynamic content, for example, retrieved from a local database or a third party source.


1
List statics
Before taking a snapshot of your server, you need to expose a server route that lists all static routes available for snapshotting.
You can do this with statics.NewRouteHandler() .
It will generate a route using the given pattern ; the resulting route will list all available GET routes for the given server as application/json .
package main

import (
    "embed"
    "log"

    "main/lib/core/routes"
    "main/lib/core/routes/statics"
    "main/lib/core/servers"
    "main/lib/core/ssr"
    "main/lib/routes/about"
    "main/lib/routes/fallback"
    "main/lib/routes/projects"
)

//go:generate frizzante clean
//go:generate frizzante configure
//go:generate frizzante generate types
//go:generate frizzante package
//go:embed app/dist
var efs embed.FS

func main() {
    server := servers.New()
    server.Efs = efs
    server.Render = ssr.New(1)
    server.Routes = []routes.Route{
        {Pattern: "GET /", Handler: fallback.View},
        {Pattern: "GET /about", Handler: about.View},
        {Pattern: "GET /projects", Handler: projects.View},
        {Pattern: "GET /@statics", Handler: statics.NewRouteHandler(server)}, // This will automatically generate a route that
                                                                              // lists all static routes of the given server.

    }
    if err := servers.Start(server); err != nil {
        log.Fatal(err)
    }
}
2
Start the application
It doesn't matter how you start the application, you can do it in development mode, in production mode or whatever other mode you're using.
All that matters is that GET /@statics is reachable.

A
B
Start production server
frizzante build && ./.gen/bin/app
3
Snapshot
Run the frizzante cli and point it to the GET /@statics route.
frizzante generate snapshot http://127.0.0.1:8080/@statics
This will retrieve the list of static routes from http://127.0.0.1:8080/@statics and generate the output in ./.gen/snapshot .
Tip
The default frizzante project comes with a makefile which already defines a shortcut
snapshot:
    frizzante generate snapshot http://127.0.0.1:8080/@statics
so you could also run
make snapshot

You can publish the .gen/snapshot directory to a CDN and your website should render statically.