import express from 'express';
import path from 'path';
import bodyParser from 'body-parser';
import api from './api';

let server = null;

function start(port) {
    return new Promise((resolve, reject) => {
        if (server !== null) {
            reject(new Error('The server is already running.'));
        }
        let app = express();
        app.use(express.static(path.join(__dirname, '../public')));
        app.use(bodyParser.json({ limit: '1.5MB' }));
        app.use('/api', api);
        server = app.listen(port, () => {
            resolve();
        });
    });
}

function stop() {
    return new Promise((resolve, reject) => {
        if (server === null) {
            reject(new Error('The server is not running.'));
        }
        server.close(() => {
            server = null;
            resolve();
        });
    });
}

export default {
    start,
    stop
};

import express from 'express';
import path from 'path';
import bodyParser from 'body-parser';
import api from './api';

let server = null;

function start(port) {
    return new Promise((resolve, reject) => {
        if (server !== null) {
            reject(new Error('The server is already running.'));
        }
        let app = express();
        app.use(express.static(path.join(__dirname, '../public')));
        app.use(bodyParser.json({ limit: '1MB' }));
        app.use('/api', api);
        server = app.listen(port, () => {
            resolve();
        });
    });
}

function stop() {
    return new Promise((resolve, reject) => {
        if (server === null) {
            reject(new Error('The server is not running.'));
        }
        server.close(() => {
            server = null;
            resolve();
        });
    });
}

export default {
    start,
    stop
};

--- 
+++ 
@@ -12,7 +12,7 @@
         }
         let app = express();
         app.use(express.static(path.join(__dirname, '../public')));
-        app.use(bodyParser.json({ limit: '1MB' }));
+        app.use(bodyParser.json({ limit: '1.5MB' }));
         app.use('/api', api);
         server = app.listen(port, () => {
             resolve();
Increase payload limit to 1.5MB

When editing a model, this allow the user to upload a 1MB file, rather
than something like a 925.3kB file, along with about 500kB of
description text.
