Skip to main content

serve_site

Function serve_site 

Source
pub fn serve_site(site_dir: &Path) -> Result<(), SsgError>
Expand description

Converts a site directory path to a string and starts an HTTP server.

This function blocks while the server is running.

§Examples

use ssg::server::serve_site;
use std::path::Path;

// Blocks until the HTTP server stops — only ever called from `run`.
let _ = serve_site(Path::new("public"));

§Errors

Returns an error if site_dir contains invalid UTF-8.