Created
May 15, 2017 19:55
-
-
Save Alek-S/e6001fccd4b0a3cd635c109340005df8 to your computer and use it in GitHub Desktop.
Express Server Starter Template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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