yolen
11/13/2018, 2:26 PMHarshit
11/13/2018, 2:34 PMHarshit
11/13/2018, 2:34 PMHarshit
11/13/2018, 2:37 PMHarshit
11/13/2018, 2:39 PMconst s = await server.start(....) I guessHarshit
11/13/2018, 2:40 PMs.close() laterHarshit
11/13/2018, 2:41 PMapp.use or equivalent calls you wanna make you can use server.express.use()yolen
11/13/2018, 2:46 PMimport express from 'express';
import {
createLightship
} from 'lightship';
const app = express();
app.get('/', (req, res) => {
res.send('Hello, World!');
});
const server = app.listen(8080);
const lightship = createLightship();
lightship.registerShutdownHandler(() => {
server.close();
});
// Lightship default state is "SERVER_IS_NOT_READY". Therefore, you must signal
// that the server is now ready to accept connections.
lightship.signalReady();Harshit
11/13/2018, 2:47 PMyolen
11/13/2018, 2:53 PMHarshit
11/13/2018, 2:53 PMHarshit
11/13/2018, 2:53 PMyolen
11/13/2018, 2:54 PMyolen
11/13/2018, 2:56 PMconst server = new GraphQLServer({
typeDefs: './src/schema.graphql',
resolvers,
context: {
db: prisma,
},
} as any)
.........
server.start(options, ({ port, ...otherArgs }) => {
console.log(
`Server is running on <http://localhost:${port}${>
process.env.GRAPHQL_SERVER_ENDPOINT
}`,
)
console.log(`Playground is running on <http://localhost:${port}${playground}`>)
})Harshit
11/13/2018, 2:56 PMHarshit
11/13/2018, 2:57 PMyolen
11/13/2018, 8:45 PMconst yoga_server_promise: Promise<HttpServer | HttpsServer> = server.start(options, ({ port, ...otherArgs }) => {
console.log(
`Server is running on <http://localhost:${port}${>
process.env.GRAPHQL_SERVER_ENDPOINT
}`,
)
console.log(`Playground is running on <http://localhost:${port}${playground}`>)
})
//for k8s readiness and liveness probes
const lightship = createLightship()
lightship.registerShutdownHandler(async () => {
const server = await yoga_server_promise
server.close()
})
// Lightship default state is "SERVER_IS_NOT_READY". Therefore, you must signal
// that the server is now ready to accept connections.
lightship.signalReady()