Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function start() {
const app = express()
app.use(cors())
app.get("/health", (req, res) => res.sendStatus(200))
const schema = makeExecutableSchema({
typeDefs,
resolvers,
resolverValidationOptions: {
requireResolversForResolveType: false
}
});
app.use("/rest", useSofa({
schema,
}))
// connect to db
const client = await connect(config.db);
const apolloConfig = {
schema,
context: async ({
req
}: { req: express.Request }) => {
// pass request + db ref into context for each resolver
return {
req: req,
db: client,
pubsub