forked from cypress-io/cypress-example-recipes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
34 lines (26 loc) · 744 Bytes
/
server.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
33
34
const path = require('path')
const minimist = require('minimist')
const express = require('express')
const app = express()
// get port from passed in args from scripts/start.js
const port = minimist(process.argv.slice(2)).port
const data = {
env: 'development',
api: 'https://api.company.com',
}
app.set('views', __dirname)
app.set('view engine', 'hbs')
app.use(express.static('.'))
app.use('/node_modules', express.static(path.join(__dirname, '..', '..', 'node_modules')))
app.get('/bootstrap.html', (req, res) => {
res.render('./bootstrap.hbs', {
data: JSON.stringify(data),
})
})
app.get('/xhr.html', (req, res) => {
res.render('./xhr.hbs')
})
app.get('/data.json', (req, res) => {
res.json(data)
})
app.listen(port)