Skip to content

Instantly share code, notes, and snippets.

@Alek-S
Created May 15, 2017 19:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Alek-S/e6001fccd4b0a3cd635c109340005df8 to your computer and use it in GitHub Desktop.
Save Alek-S/e6001fccd4b0a3cd635c109340005df8 to your computer and use it in GitHub Desktop.
Express Server Starter Template
'use strict';
//==MODULES==
const express = require('express');
const bodyParser = require('body-parser');
//==Express Setup==
const app = express();
app.set('port', (process.env.PORT || 5000));
//===Parsing===
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.text());
app.use(bodyParser.json({ type: 'application/vnd.api+json' }));
//===Static Files, CSS,Images,Fonts===
app.use(express.static('public'));
//===Routes===
require('./controllers/apiroutes.js')(app);
//==Start Server==
app.listen(app.get('port'), function() {
console.log('Node app is running on port', app.get('port'));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment