import { on } from 'nexus

Guide

The lifecycle component is designed for tapping into app events. This can be useful when you need to run eager code that wouldn't play well with Nexus' reflection system. If you are new to this component then you may be interested in our lifecycle guide.

start

Register callback to be run when the application starts.

Signature

1(data: {
2 schema: NexusGraphQLSchema
3}) => void

Example

1import { on, log } from 'nexus'
2
3on.start(data => {
4 log.info('app started', { schema: data.schema })
5})

Remarks

Put initialization code here that you don't want run during Nexus refletion.

Edit this page on Github