In VSCode choose File -> Add Folder to Workspace, choose data-access.
VS Code should recognize that this is an Azure Functions Project, and click "Yes" to the dialog.
Choose File -> Save Workspace As... change the file name to sharethrift.code-workspace and save in the serverless-quickstart directory.
edit the .vscode/launch.json file and change the port to 9230 as port 9090 is used by Dapr for metrics, and we don't want do have each developer modify their Dapr configuration.
azure-quickstart/data-access/.vscode/launch.json
{..."configurations":[..."port":9230,... ]...}
edit ./tsconfig.json add the following to the compilerOptions settings:
azure-quickstart/data-access/tsconfig.json
"esModuleInterop":true,
Replace ./graphql/index.ts with:
azure-quickstart/data-access/graphql/index.ts
import { ApolloServer, gql } from'apollo-server-azure-functions';// Construct a schema, using GraphQL schema languageconsttypeDefs=gql` type Query { hello: String }`;// Provide resolver functions for your schema fieldsconstresolvers= { Query: {hello: () =>'Hello world!', },};constserver=newApolloServer( { typeDefs, resolvers, playground:true },);exports.graphqlHandler =server.createHandler();
It is typical to only use POSTs for interactions with Apollo through the API and GETs for interacting with the playground. Apollo can also be configured to allow for GETs when interacting with the API for cached results by using Automated Persisted Queries.