-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
32 lines (25 loc) · 761 Bytes
/
index.js
File metadata and controls
32 lines (25 loc) · 761 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
27
28
29
30
31
32
const express = require('express')
const app = express()
const fetchIP = require('./fetchIP')
const ipLookup = require('./ipLookup')
const wallOfThanks = require('./wall-of-thanks')
require('dotenv').config()
app.set('port', process.env.PORT || 8000)
/*
Returns the real IP address even if behind proxy
*/
app.set('trust proxy', true)
app.use(express.static(__dirname + '/public'))
app.get('/', function(req, res) {
res.sendFile('./public/index.html')
})
app.use('/fetchIP', fetchIP)
app.use('/ipLookup', ipLookup)
app.use('/wallOfThanks', wallOfThanks)
app.listen(app.get('port'), function() {
console.log("Node app is running at localhost:" + app.get('port'))
})
/*
Export the Express API for Vercel serverless function
*/
module.exports = app