Verified Commit 8273d73c authored by Aral Balkan's avatar Aral Balkan
Browse files

Cosmetic: nicer log messages on untrusted node

parent 3a1f7826
......@@ -21,7 +21,7 @@ expressWebSocket(app, server, { perMessageDeflate: false })
app.ws('/echo', (webSocket, request) => {
webSocket.on('message', message => {
console.log('Got web socket request to echo ', message)
console.log(' ⚡ [hypha] Web socket message:', message)
webSocket.send(message)
})
})
......@@ -31,6 +31,7 @@ app.ws('/echo', (webSocket, request) => {
//
app.get('/https-get', (request, response) => {
console.log(' 🌐 [hypha] HTTPS GET route called.')
response.writeHeader(200, {'Content-Type': 'text/html'})
response.end('<!doctype html><html lang=\'en\'><head><meta charset=\'utf-8\'/><title>Hello</title><style>body{background-color: white; font-family: sans-serif;}</style></head><body><h1>Hypha</h1><p>Hello, I am a dynamically-served HTTPS GET route.</p></body></html>')
})
......@@ -70,23 +71,23 @@ if (process.env.NODE_ENV === 'production') {
app.use(webCompilerMiddleware)
webCompilerMiddleware.compiler.on('error', (nodeName, edgeName, error) => {
console.log('Compiler error', nodeName, edgeName, error)
console.log(' ⚙ [web-compiler] Error:', nodeName, edgeName, error)
})
webCompilerMiddleware.compiler.on('change', function (nodeName, edgeName, nodeState) {
var node = nodeState[nodeName][edgeName]
var name = nodeName + ':' + edgeName
console.log(' [web-compiler]', name)
console.log(' [web-compiler]', name)
})
webCompilerMiddleware.compiler.on('ssr', function (result) {
console.log(' [web compiler] SSR:', result.success ? 'success' : 'fail')
console.log(' [web compiler] SSR:', result.success ? 'success' : 'fail')
})
}
// Handle errors.
app.use(function (error, request, response, next) {
console.log('Error', error)
console.log(' ❌ [hypha] Server error:', error)
response.send(500)
})
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment