import { liveApi } from './api/live_handler' ; const express = require ( 'express' ) ; const path = require ( 'path' ) ; const bodyParser = require ( 'body-parser' ) ; const app = express ( ) ; app . get ( '/live-snapshots' , liveApi ) ; const historyAPIFallback = require ( 'connect-history-api-fallback' ) ; app . use ( bodyParser . json ( ) ) ; export type ConfigCallback = ( app : any ) => void ; export interface Config { luisPath ? : string ; serverConfig ? : ConfigCallback [ ] ; } export function start ( { luisPath = `public/` , serverConfig = [ ] } = { } ) { try { for ( let config of serverConfig ) { config ( app ) ; } app . use ( historyAPIFallback ( ) ) ; app . use ( express . static ( path . resolve ( luisPath ) , { index : false } ) ) ; app . listen ( 9001 , function ( ) { console . log ( 'LUIS is listening to you on port 9001!' ) ; } ) ; } catch ( ex ) { console . error ( "ERROR!: You need to have 'luis.html' in your static directory" ) ; } }