This repository has been archived by the owner on Feb 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
77 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// server/app.js | ||
const express = require('express'); | ||
const morgan = require('morgan'); | ||
const path = require('path'); | ||
const fs = require('fs'); | ||
|
||
const app = express(); | ||
|
||
// Setup logger | ||
app.use(morgan(':remote-addr - :remote-user [:date[clf]] ":method :url HTTP/:http-version" :status :res[content-length] :response-time ms')); | ||
|
||
// Serve static assets | ||
app.use(express.static(path.resolve(__dirname, '..', 'build'))); | ||
|
||
app.get('/api/config.js', (req, res) => { | ||
fs.readFile(path.join(__dirname, 'dashboards', 'bot-framework.js'), 'utf8', (err, data) => { | ||
if (err) throw err; | ||
|
||
// Ensuing this dashboard is loaded into the dashboards array on the page | ||
data += ` | ||
window.dashboards = window.dashboards || []; | ||
window.dashboards.push(dashboard); | ||
`; | ||
|
||
res.send(data); | ||
}); | ||
}); | ||
|
||
// Always return the main index.html, so react-router render the route in the client | ||
app.get('*', (req, res) => { | ||
res.sendFile(path.resolve(__dirname, '..', 'build', 'index.html')); | ||
}); | ||
|
||
module.exports = app; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// server/index.js | ||
'use strict'; | ||
|
||
const app = require('./app'); | ||
|
||
const PORT = process.env.PORT || 4000; | ||
|
||
app.listen(PORT, () => { | ||
console.log(`App listening on port ${PORT}!`); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -443,6 +443,10 @@ base64-js@^1.0.2: | |
version "1.2.0" | ||
resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.2.0.tgz#a39992d723584811982be5e290bb6a53d86700f1" | ||
|
||
basic-auth@~1.1.0: | ||
version "1.1.0" | ||
resolved "https://registry.yarnpkg.com/basic-auth/-/basic-auth-1.1.0.tgz#45221ee429f7ee1e5035be3f51533f1cdfd29884" | ||
|
||
[email protected]: | ||
version "0.5.3" | ||
resolved "https://registry.yarnpkg.com/batch/-/batch-0.5.3.tgz#3f3414f380321743bfc1042f9a83ff1d5824d464" | ||
|
@@ -3053,6 +3057,16 @@ moment@^2.18.0: | |
version "2.18.0" | ||
resolved "https://registry.yarnpkg.com/moment/-/moment-2.18.0.tgz#6cfec6a495eca915d02600a67020ed994937252c" | ||
|
||
morgan@^1.8.1: | ||
version "1.8.1" | ||
resolved "https://registry.yarnpkg.com/morgan/-/morgan-1.8.1.tgz#f93023d3887bd27b78dfd6023cea7892ee27a4b1" | ||
dependencies: | ||
basic-auth "~1.1.0" | ||
debug "2.6.1" | ||
depd "~1.1.0" | ||
on-finished "~2.3.0" | ||
on-headers "~1.0.1" | ||
|
||
[email protected]: | ||
version "0.7.1" | ||
resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.1.tgz#9cd13c03adbff25b65effde7ce864ee952017098" | ||
|