-
Notifications
You must be signed in to change notification settings - Fork 0
/
testapp.js
31 lines (21 loc) · 666 Bytes
/
testapp.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
const express = require('express')
const app = express()
const port = 3000
const beans = require('./index')
beans.plantBeans('xxxx')
app.use(beans.routeLogger( (req )=>{
//this function sets user identifiers that can be stored on the db
if ( !req.user) {
return ""; //must be a string
}
return req.user.email || ""; ///optional customise return messages
} ,(req)=>{
//this function lets users set custom meta data to be stored
return {}; //set meta data
}))
app.get('/hello', (req, res) => {
res.send('Hello World!')
})
app.listen(port, () => {
console.log(`Example app listening on port ${port}`)
})