Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const swaggerUi = require('swagger-ui-express')
const YAML = require('yamljs')
const authenticator = require('tc-core-library-js').middleware.jwtAuthenticator
const fileUpload = require('express-fileupload')
const memwatch = require('memwatch-next')

const swaggerDocument = YAML.load('./docs/swagger.yaml')
const app = express()
Expand All @@ -30,6 +31,19 @@ app.use(bodyParser.urlencoded({ limit: '50mb', extended: true }))
app.use(cors())
app.use(fileUpload())

memwatch.on('leak', function (info) {
winston.info(`Memory leak detected, details: ${info}`)
const reqBody = {
topic: 'common.error.reporting',
originator: 'submission-api',
timestamp: (new Date()).toISOString(), // time when submission was created
'mime-type': 'application/json',
payload: info
}

helper.postToBusApi(reqBody)
})

const apiRouter = express.Router()

/**
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"http-status": "^1.2.0",
"joi": "^13.4.0",
"lodash": "^4.17.15",
"memwatch-next": "^0.3.0",
"superagent": "^3.8.3",
"swagger-ui-express": "^3.0.10",
"tc-bus-api-wrapper": "topcoder-platform/tc-bus-api-wrapper.git#feature/auth0-proxy-server",
Expand Down