Skip to content

Instantly share code, notes, and snippets.

@tkssharma
Created September 10, 2019 10:26
Show Gist options
  • Save tkssharma/d30621201f89cd04edad1de91fe7c443 to your computer and use it in GitHub Desktop.
Save tkssharma/d30621201f89cd04edad1de91fe7c443 to your computer and use it in GitHub Desktop.
const app = express();
app.use(bodyParser.json());
app.use(
'/graphql',
graphqlHttp({
schema: graphQlSchema,
rootValue: graphQlResolvers,
graphiql: true
})
);
mongoose
.connect(
`mongodb+srv://${process.env.MONGO_USER}:${
process.env.MONGO_PASSWORD
}@cluster0-ntrwp.mongodb.net/${process.env.MONGO_DB}?retryWrites=true`
)
.then(() => {
app.listen(8000);
})
.catch(err => {
console.log(err);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment