Skip to content

ramurama/graph-api

Repository files navigation

Graph Database Prototype

Task description:

Goal: To create a backend application using NestJS and GraphDB. Drivine should be used as a database client. Instagram data schema has to be used. Data can be fetched from Instagram web API and persisted in the graph database using Drivine. Endpoints has to be exposed to query any of the available data from the graph database.

Outcome:

A backend app connected to a drivin supported graph database with a query-interface (no fancy UI necessary - plain REST to curl is fine) return some persisted instagram data

Tools which could be helpful:

Installation

$ npm install

Prerequisites

Before running the application you need to download and install Neo4J community server or Neo4J Desktop (preferred). Create a database and update the entries in the .env file (Like passsword, database name/passsword. Usually database name would be 'neo4j').

Start the database in the Neo4J project view.

Environment Variables

  • Rename the .env.sample file to .env
  • Update the database name/password if you have any.
  • Update the following entries.
INSTAGRAM_USERNAME=<YOUR-INSTAGRAM-USERNAME>
INSTAGRAM_PASSWORD=<YOUR-INSTAGRAM-PASSWORD>

Testing the app

# development
$ npm run test:e2e

Running the app

# development
$ npm run start

Endpoints

Execute the following endpoints sequentially in order to fetch data using Instagram API and save it to database before viewing it.

# fetch and save user to the local database
http://localhost:3000/instagram/user/<IMSTAGRAM-USERNAME>
# get all users from local database
http://localhost:3000/local/users

Note: INSTAGRAM-USERID is exactly the same value as the id field from the previous endpoint.

# fetch and save followers of the user to the local database
http://localhost:3000/instagram/follows/<INSTAGRAM-USERID>
# fetch followers of the user from the local database
http://localhost:3000/local/follows/<INSTAGRAM-USERID>

Other endpoints:

# get one user from local database
http://localhost:3000/local/users/<IMSTAGRAM-USERNAME>

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published