A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/zacanger/koa-simple-static below:

zacanger/koa-simple-static: Simple caching static file server for Koa

Simple caching static file server for Koa

Similar to koa-static-cache, but with different options, better API, and in TypeScript.

Features:

app.use(serve({
  dir: process.cwd()
}))
import serve from 'koa-simple-static'
import { resolve } from 'path'
import Koa from 'koa'

const app = new Koa()
const port = process.env.PORT || 4444

app.use(serve({
  dir: resolve(__dirname, 'public'),
  extraHeaders: [ { 'X-Something-Whatever': 'foo, bar' } ]
}))

app.listen(port, () => {
  console.log(`Serving on ${port}!`)
})

Important if you're using require, you'll need to require('koa-simple-static').default.

LICENSE


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4