Skip to content

Instantly share code, notes, and snippets.

@TaylorAckley
Last active February 12, 2017 22:37
Show Gist options
  • Save TaylorAckley/a90995e064a8bc65fca645e34b00156e to your computer and use it in GitHub Desktop.
Save TaylorAckley/a90995e064a8bc65fca645e34b00156e to your computer and use it in GitHub Desktop.
"use strict";
//npm i express morgan body-parder method-override path cors moment request bluebird lodash --save
const express = require('express');
const app = express();
var server = require('http').createServer(app);
const morgan = require('morgan');
const bodyParser = require('body-parser');
const methodOverride = require('method-override');
const path = require('path');
const cors = require('cors');
const moment = require('moment');
const request = require('request');
const appConfig = require('./backend/app.config.js');
app.use(morgan('dev')); // log with Morgan
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
extended: true
}));
app.use(bodyParser.text());
app.use(bodyParser.json({
type: 'application/vnd.api+json'
}));
app.use(methodOverride());
app.use(cors());
// Routing
app.use(express.static(__dirname + '/public'));
app.get('/', function(req, res) {
res.sendFile(__dirname + '/index.html');
});
console.log(appConfig);
server.listen(appConfig.port, function() {
console.log('Server listening at port %d', appConfig.port);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment