Express graphql9/14/2023 ![]() ![]() If you're new to Apollo and GraphQL, a great way to learn is to actually build something in real life. I personally really love the fact that Apollo Server is non-intrusive and can be tacked on any project as an alternative way to communicate between services and applications. Connect your GraphQL Server with server.applyMiddleware.How simple was that? Is your popcorn finished? Summary Note: If you want to change the URL that the GraphQL endpoint sits at from /graphql to something else, you can pass in a path option to server.applyMiddleware() with the URL you want, like path: '/specialUrl'. If you navigate to localhost:5000/graphql, you should be able to see your GraphQL schema in the GraphQL playground. Existing routes for our Express.js appĪpp.listen(port, () => console.log(`: Listening on port $`) Let's say that your server looked something like the following. If you have an old Express.js RESTful API lying around or you're interested in incrementally adopting GraphQL, we only need 2 minutes to hook it up with a fresh new GraphQL Server. You can get a lot done in 2 minutes, like microwaving popcorn, sending a text message, eating a cupcake, and hooking up a GraphQL server. ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |