Skip to content
KeystoneJS LogoKeystoneJS

Static file app

View changelog

A KeystoneJS app to serve static files such as images, CSS and JavaScript with support for client side routing.

Usage

index.js

const { Keystone } = require('@keystonejs/keystone');
const { GraphQLApp } = require('@keystonejs/app-graphql');
const { AdminUIApp } = require('@keystonejs/app-admin-ui');
const { StaticApp } = require('@keystonejs/app-static');

module.exports = {
  keystone: new Keystone(),
  apps: [
    new GraphQLApp(),
    new AdminUIApp(),
    new StaticApp({
      path: '/',
      src: 'public',
      fallback: 'index.html',
    }),
  ],
};

Config

OptionTypeRequiredDescription
pathstringtrueThe path to serve files from.
srcstringtrueThe path to the folder containing static files.
fallbackstringfalseThe path to the file to serve if none is found. This path is resolved relative to the src path.

On this page

  • Usage
  • Config
Edit on GitHub