A custom NoSQL database using JSON documents written in Go
It is a custom-built NoSQL database which supports collections and JSON documents. It also provides an API for performing the CRUD operations on the data.
To run the database locally:
- Clone the repository
git clone https://github.com/KanzaSheikh/customJSONDocDB.git
. - Navigate to the cmd/main directory.
- Run the project
go run main.go
.
Upon running the application, an HTTP server is started which can be accessed through the local API at port 8000 to perform simple CRUD operations.
Following are a few example operations:
The database supports two kinds of read operations i.e. reading all documents and reading documents by ID.
For reading all documents within a collection, run:
curl --request GET http://localhost:8000/users
For reading a document by ID:
curl --request GET http://localhost:8000/users/{id}
New documents can be created within a collection by using the following route. If a collection already exists, the document is created inside it, otherwise a new collection is created.
curl --request POST http://localhost:8000/users --header "Content-Type: application/json" --data '{body}'
For deleting existing documents, run:
curl --request DELETE http://localhost:8000/users/{id}