Professional Documents
Culture Documents
smith / newrelic-graphql-react-example
Example of using the New Relic GraphQL API in a front-end React application
Apache-2.0 License
2 stars 0 forks
Star
Watch
Code
Issues
Pull requests 3
Actions
Security
Insights
master
Go to file
View code
README.md
Installation
You'll need Node.js and Yarn installed.
Run yarn to install the dependencies.
{
requestContext {
apiKey
}
}
This will start the application on port 3000 and open a browser window.
Congratulations! You've just connected to the New Relic GraphQL API!
src/types contains the default generated type information based on the schema and the existing queries.
If you change your queries you can run:
to generate updated type annotations. Adding --watch will run a process to continuously update the annotations when
queries are changed.
For example, src/index.tsx imports the UserQuery type and uses it to specify the type of the data object in the query.
Your text editor can provide autocompletion and inline documentation for these types.
Deployment to production
DON'T!
This repository is for example purposes only. If you compile the code and host it publically, your API key WILL BE
COMPROMISED. Since this is a front-end only JavaScript application, anyone using the application will be able to see
your API key in the request headers used in the GraphQL queries.
If you must make a build of the static files, it can be done with:
What's next?
You can use the documentation and API explorer to see everything that's possible.
Making changes in the application will cause the page to reload with new results.
More help can be found on the New Relic Explorers Hub.
Releases
No releases published
Contributors 2
Languages