Repository URL to install this package:
|
Version:
1.3.8 ▾
|
import portscanner from 'portscanner'
import {
createApp,
// corsOptions,
// graphqlSubApp,
// graphiqlSubApp,
proxyMiddleware,
cookieMiddleware,
// schema,
} from './newApp'
/**
* is happening 2x...
*/
function startStandalone() {
if (process.env.IS_STANDALONE_GRAPHQL) {
console.log('[uxui-graphql] creating app...')
const app = createApp()
console.log('[uxui-graphql] about to listen...')
const port = process.env.PORT || '4000'
// if (isPortFree(port)) {
// const listener = app.listen(parseInt(process.env.PORT, 10) || 4000, () => {
// console.log('[uxui-graphql] listening on port 4000')
// })
// console.log('[uxui-graphql] async after listening')
// process.on('SIGTERM', () => {
// console.log('[uxui-graphql] SIGTERM')
// listener.close()
// })
// }
portscanner.checkPortStatus(port, '0.0.0.0', (err, status) => {
if (err) console.error(err)
if (status === 'closed') {
const listener = app.listen(parseInt(port), () => {
console.log('[uxui-graphql] listening on port ' + port)
})
console.log('[uxui-graphql] async after listening')
process.on('SIGTERM', () => {
console.log('[uxui-graphql] SIGTERM')
})
}
})
} else {
console.log('[uxui-graphql] NOT standalone')
}
}
// startStandalone()
// import { ApolloEngine } from 'apollo-engine'
// @todo try try again
// const engine = new ApolloEngine({
// apiKey: 'service:skava-engine:_oygzZUWfir8gDOh7kpgAQ',
// logging: {
// level: 'INFO',
// },
// })
// Start the server
// engine.listen({
// port: 4000,
// expressApp: app,
// })
export {
createApp,
startStandalone,
}
export default {
createApp,
startStandalone
}
// // corsOptions,
// // graphqlSubApp,
// // graphiqlSubApp,
// proxyMiddleware,
// cookieMiddleware,
// // schema,
}