Skip to content

Instantly share code, notes, and snippets.

@SuperManEver
Created August 26, 2016 17:28
Show Gist options
  • Save SuperManEver/c3f41624f1a41907dca481ccb8a0478c to your computer and use it in GitHub Desktop.
Save SuperManEver/c3f41624f1a41907dca481ccb8a0478c to your computer and use it in GitHub Desktop.
backend example
var express = require('express');
var app = express();
var path = require('path');
app.set('port', (process.env.PORT || 5000));
app.use(express.static(__dirname + '/public'));
app.get('/', (req, res) => {
res.sendFile(path.join(__dirname, 'public', 'index.html'));
});
app.get('/stories', (req, res) => {
res.sendFile(path.join(__dirname, 'public', 'index.html'));
});
app.get('/bookmarks', (req, res) => {
res.sendFile(path.join(__dirname, 'public', 'index.html'));
});
app.listen(app.get('port'), () => {
console.log('Example app listening on port 3000', app.get('port'));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment