Host static files

serve_static.ts is a built-in middleware for hosting static files (html, image, stylesheets and more).

In the example below, all files in ./public directories are automatically served if request path matches file. For instance, ./public/index.csswill be served as

If no files found on requested path, request will be passed into the next middleware.

// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license.
import { serveStatic } from "";
import { createApp } from "";
const app = createApp();
// All requests will be processed and matched files in "public" directory
// are served automatically
// Otherwise, request will be passed to next handler
app.listen({ port: 8899 });