import express from 'express';
import logger from 'morgan';
import compression from 'compression';
import favicon from 'serve-favicon';
import herokuSslRedirect from 'heroku-ssl-redirect';
import cookieParser from 'cookie-parser';
import bodyParser from 'body-parser';
import publishAllApi from '@/server/api/publish-all';
import publishApi from '@/server/api/publish';
import unpublishApi from '@/server/api/unpublish';
import { publishAll, buildIndex, buildGallery } from '@/server/index';

const app = express();

// Serve the static files
// app.use(favicon('public', 'inuksuk.ico'));
app.use(herokuSslRedirect());
app.use(compression());
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(cookieParser());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(express.static('public'));

// Listen for rebuild requests
app.get('/publish', publishAllApi);
app.get('/publish/:id', publishApi);
app.get('/unpublish/:id', unpublishApi);

// Custom routes
app.get('/galerie', (req, res) => res.sendFile('/public/gallery.html', { root: process.cwd() }));
app.get('/bolg', (req, res) => res.sendFile('/public/bolg.html', { root: process.cwd() }));

// catch 404 and forward to error handler
// TODO: Find a way to manage errors
/* app.use((req, res, next) => {
  const err = new Error('Not Found');
  err.status = 404;
  next(err);
});

// error handler
app.use((err, req, res) => {
  // set locals, only providing error in development
  res.locals.message = err.message;
  res.locals.error = req.app.get('env') === 'development' ? err : {};

  // render the error page
  res.status(err.status || 500);
  res.render('error');
}); */
publishAll().then(buildIndex).then(buildGallery);

export default app;

@@ -51,24 +51,50 @@
  'morgan';%0D%0A
+import path from 'path';%0D%0A
 import compr
@@ -577,19 +577,16 @@
  files%0D%0A
-// 
 app.use(
@@ -593,16 +593,37 @@
 favicon(
+path.join(__dirname, 
 'public'
@@ -629,22 +629,23 @@
 ', '
-inuksuk
+favicon
 .ico'))
+)
 ;%0D%0Aa

Add favicon server