"use strict"; // Dependencies var express = require( 'express' ); var app = express(); var bodyParser = require( 'body-parser' ); app.use( bodyParser.text() ); app.use( bodyParser.urlencoded( { extended: true } ) ); // Config var config = require( './config.json' ); // Landing page for status checks app.get('/', function( req, res ) { var msg = 'slash-done running'; res.send( msg ); }); // Parse POST body to create WP post app.post('/log', function( req, res ) { // Don't bother if there's nothing to record if ( 'undefined' === typeof req.body || ! req.body.length ) { return res.sendStatus( 400 ); } res.sendStatus( 200 ); }); //tells Node which port to listen on app.listen( config.node_port, config.node_listener, function() { console.log( 'slash-done running on', config.node_listener, 'and port', config.node_port ); });