Skip to content

OkuruchiDan/challenge

Repository files navigation

What is it

This is a Next.js project bootstrapped with create-next-app.

This project about complete challenge.

Project setup

Firstly was created a new Project with https://cloud.hasura.io/ default setup. With Postgres database on Heroku that created with Create Heroku Database option.

Data keeping

All data(like long_tails table etc.) taken from challenge and inserted with Hasura interface into database. The example.json file is keeping in glitch as a simple project.

Project Configuration

Firstly was generated a simple GraphQl query depends on database structure.The next step was about create an Action and Action handlers.

Relative to the documentation Action handlers was created and deployed with glitch, we use it for get the example.json file and throw it to our Hasura app.

API REST configuration

After all steps above are passed we can configure a simple endpoint using Hasura interface and mix our Query into database and Action with example.json to get all data together.

Getting Started

First, configure the .env.local file.

cp .env.example .env.local

You can find .env.example file in root of this project , that will have values like:

HASURA_API_URL=
HASURA_ADMIN_SECRET=

HASURA_API_URL - this is URL of hasura project (using API rest).

HASURA_ADMIN_SECRET - this is a key for authorization on Hasura.

Second, run the development server:

npm run dev
# or
yarn dev

Open http://localhost:3000 with your browser to see the result.

The home page of app will show you a menu with 3 links, that will redirect you to results pages.

Deployment

App

You can find it by this LINK.

This app deployed using Vercel. With environment configuration like in .env.example. All other configs are defaults for Vercel.

Glitch

All glitch project that was mentioned in this doc have a default options of configuration.