From 8c50fc8b83d5fa7b48d45b7330cbc274b41edd72 Mon Sep 17 00:00:00 2001 From: bill bittner Date: Wed, 2 May 2018 13:08:25 -0700 Subject: [PATCH] hard coded /public folder --- index.js | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/index.js b/index.js index 60af5519..3b91ed8a 100644 --- a/index.js +++ b/index.js @@ -29,21 +29,18 @@ function Server () { app.enable('trust proxy'); /* add middleware */ + // set HTTP headers to protect against well-known web vulnerabilties app.use(helmet()); + // 'express.static' to serve static files from public directory - if (siteConfig.routes.publicFolder) { - // take in a different public folder, so it can serve it's own bundle if needed - const publicFolder = Path.resolve(process.cwd(), siteConfig.routes.publicFolder); - app.use(express.static(publicFolder)); - logger.info('serving static files from custom path:', publicFolder); - } else { - const publicPath = Path.resolve(process.cwd(), 'public'); - app.use(express.static(publicPath)); - logger.warn(`serving static files from default static path at ${publicPath}. Please specify a path in your config/siteConfig.js file`); - }; + const publicPath = Path.resolve(process.cwd(), 'public'); + app.use(express.static(publicPath)); + logger.info(`serving static files from default static path at ${publicPath}.`); + // 'body parser' for parsing application/json app.use(bodyParser.json()); + // 'body parser' for parsing application/x-www-form-urlencoded app.use(bodyParser.urlencoded({ extended: true }));