This project consists in creating a basic structure wich uses both REST and Graphql patterns, by using Express and Apollo Server frameworks.
Express is used for handle public requests, with the creation of public enpoints. And Apollo Server is used for handle private requests by the verification and decoding of JWTs on the context function. This is useful for cases when it's not convenient to use Apollo Server authentication solutions
- Run
npm installoryarn install - Run
npm startoryarn start - Send a GET request for [address:port]/api/hello. You should get a 200 response with the string "Hello world from public endpoint"
- Send "query { hello }" for [address:port]/graphql ( or use the Graphql Playground ). You should get an unauthenticated error.
- Generate a token with the generateToken script by runing
node generateToken.js - Repeat the step 4 using the token. You should get a hello world response from the Apollo Server.