Node application which provides API endpoints using express to perform alteration, mutation, and querying.
This project is an example project for Dgraph-js. There are 2 nodes - User node and Company node with edges works.for
and connection
.
Using Docker Compose, we can quickly get started.
# Cloning the repository
git clone https://github.com/prashant-shahi/dgraph-nodejs-example
# Changing the directory
cd dgraph-nodejs-example
# (Optional) You can skip image building by pulling the image from DockerHub
docker-compose pull
# Building needed images and running those containers
docker-compose up
API | Functionality | Remarks |
---|---|---|
/ |
Checking server status | Returns status success with the response server up, if server is successfully up. |
/clear |
Clears all the data present in Dgraph | With no data present, schema automatically clears off. |
/load-data |
Loads the sample data in Dgraph | Clears data, alters the schema, and, perform mutation to add the sample data. |
/query |
Querying for data in Dgraph | Existing child nodes to one level nested ones are also included. |