-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
26 lines (21 loc) · 691 Bytes
/
index.js
File metadata and controls
26 lines (21 loc) · 691 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
var express = require('express');
var morgan = require('morgan');
var parser = require('body-parser');
var favicon = require('serve-favicon');
var dotenv = require('dotenv');
dotenv.load();
var app = express();
var weather = require('./api/weather');
app.set('port', (process.env.PORT || 5000));
app.use(favicon(__dirname + '/public/favicon.ico'));
app.use(express.static(__dirname + '/public'));
app.use(morgan('dev'));
app.use(parser.urlencoded({extended: false}));
app.use(parser.json());
app.use('/api/weather', weather);
app.get('/', function(req, res){
res.render('index.html');
});
app.listen(app.get('port'), function (){
console.log('Listening on ' + app.get('port'));
});