Files
speckle-server/packages/server/bin/ts-www
T
Iain Sproat 5e4a6c5635 fix(server/prometheus): ensure consistent Prometheus registry is used (#4106)
* fix(server/prometheus): ensure consistent Prometheus registry is used
- there was a conflicting dependency between Metrics initialization and Modules initialization; resolved by separating registry initialization from metrics initialization
- pass in the registry to prevent implicit dependency being broken
- when registering a metric, first attempt to remove any of existing metrics with same name to prevent errors
- to prevent sneaky uses of the implicit registry, replace default import with explicit import so it is clearer when prometheusClient.registry is used

* Add tests for registering metrics
2025-03-04 08:41:53 +00:00

25 lines
731 B
JavaScript
Executable File

#!/usr/bin/env node
'use strict'
/**
* Same as 'www', but runs the app from source code directly through ts-node, so no need to build the app into /dist first.
* Although ts-node with swc is pretty fast, in production environments you should use `www` and a built app.
*/
require('ts-node/register')
const { logger } = require('../observability/logging')
const { init, startHttp } = require('../app')
init()
.then(({ app, graphqlServer, registers, server, readinessCheck }) =>
startHttp({ app, graphqlServer, registers, server, readinessCheck })
)
.catch((err) => {
logger.error(err, 'Failed to start server. Exiting with non-zero exit code...')
// kill it with fire 🔥
process.exit(1)
})
// 💥