-- May 10 In-Class Exercise
Mykhailo Behei
//config.js
var config = {
foo: 'foo',
goo: 'goo'
}
module.exports = config;
//app.js
var config = require('./config');
var express = require('express');
var app = express();
var logger = function(req, res, next) {
console.log(req.ip + " --> " + req.path);
next();
}
app.use(logger);
app.get('/*foo*', function(req, res) {
res.send('<!DOCTYPE html><html><head><title>In class exercise</title></head><body>' + config.foo + '</body></html>')
})
app.get('*', function(req, res) {
res.send('<!DOCTYPE html><html><head><title>In class exercise</title></head><body>' + config.goo + '</body></html>')
})
app.listen(8888, function() {
console.log('Server running on 8888!')
})
Mykhailo Behei
//config.js
var config = {
foo: 'foo',
goo: 'goo'
}
module.exports = config;
//app.js
var config = require('./config');
var express = require('express');
var app = express();
var logger = function(req, res, next) {
console.log(req.ip + " --> " + req.path);
next();
}
app.use(logger);
app.get('/*foo*', function(req, res) {
res.send('<!DOCTYPE html><html><head><title>In class exercise</title></head><body>' + config.foo + '</body></html>')
})
app.get('*', function(req, res) {
res.send('<!DOCTYPE html><html><head><title>In class exercise</title></head><body>' + config.goo + '</body></html>')
})
app.listen(8888, function() {
console.log('Server running on 8888!')
})