Giter Club home page Giter Club logo

hygraph-acme's Introduction

Acme Website - Hygraph's Interview case study

This is a NextJS project that uses hygraph to create all the pages for this website.

Getting Started

1- Dependency installation

This project uses PNPM to handle dependencies. run

pnpm install

to get all dependencies installed.

2- Configure the environment

Create a .env in the project's root folder with the following keys:

SITE_URL=???
HYGRAPH_BASE_URL=???
HYGRAPH_TOKEN=???

make sure you replace the ??? values with the real values for this project.

3- Run the dev server

This project uses Codegen to automatically handle types in your graphQL queries. When running

pnpm dev

the NextJS server and the Codegen watcher will start executing. The local version will be available in http://localhost:3000 and whenever you make a change in your graphQL queries Codegen will update the types.

4- Updating the types when changing the Hygraph Schema

When making changes in the Hygraph Schema you'll need to rerun the Codegen command to get the updated types from Hygraph. To do so just run:

pnpm codegen

and your types will be automatically updated.

Testing

This project uses React Testing Library with Jest for testing. To run the tests execute the command:

pnpm test

If you want to update the Snapshot tests run:

pnpm test -- -u

Webhooks and ISR

This project statically generates the pages for the URLs defined in Hygraph. There's a webhook configured in Hygraph that automatically regenerates the pages when a page is edited by calling the api/webhook/revalidate with a POST method.

hygraph-acme's People

Contributors

skolz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.