forked from fdnd-task/connect-your-tribe-profile-card
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
32 lines (24 loc) · 977 Bytes
/
index.js
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
// Importeer express uit de node_modules map
import express from 'express'
const url = 'https://whois.fdnd.nl/api/v1/member/fatihg61'
const data = await fetch(url).then(( response) => response. json())
// console.log(data.member.name)
// Maak een nieuwe express app aan
const app = express()
// Stel ejs in als template engine en geef de 'views' map door
app.set('view engine', 'ejs')
app.set('views', './views')
// Gebruik de map 'public' voor statische resources
app.use(express.static('public'))
// Maak een route voor de index
app.get('/', function (req, res) {
// res.send('Hello World!')
res.render('index', data)
})
// Stel het poortnummer in waar express op gaat luisteren
app.set('port', process.env.PORT || 8000)
// Start express op, haal het ingestelde poortnummer op
app.listen(app.get('port'), function () {
// Toon een bericht in de console en geef het poortnummer door
console.log(`Application started on http://localhost:${app.get('port')}`)
})