loading
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
const { runHookApp, traceBoot } = require('@forrestjs/hooks')
const serviceExpress = require('@forrestjs/service-express')

const homePage = ({ registerRoute }) =>
  registerRoute.get('/', (req, res) => {
    res.send(`
      <p>Hello World</p>
      <a href="/foo">Next page</a>
    `)
  })

const fooPage = ({ registerRoute }) =>
  registerRoute.get('/foo', (req, res) => {
    res.send(`
      <p>"Foo" route</p>
      <a href="/">go back</a>
    `)
  })

runHookApp([
    traceBoot,
    serviceExpress,
    [ '$EXPRESS_ROUTE', homePage ],
    [ '$EXPRESS_ROUTE', fooPage ],
])
node v10.16.0