This project is the back-end for all Hazlazuardi's front-end projects. The stack used in this project includes NextJs, Prisma, and PostgreSQL.
NextJs is the back end of the project. Prisma is responsible as an ORM. Lastly, this project uses PostgreSQL as the database.
Make sure your machine has Docker installed and ready to use. Follow the documentation here to get started with Docker. Also, make sure to clone this repository into your local machine.
To run the development server:
docker compose up -d
After the docker container status becomes running, you can access the app on http://localhost:8080
.
Prisma Studio is a modern GUI to access and manage data inside the database that connects with a Prisma project.
Since this project uses Prisma as the ORM, you can utilize Prisma Studio.
To open Prisma Studio:
- Open Docker Desktop.
- Open the project container's CLI.
In the project container's CLI, run:
npx prisma studio
After Prisma Studio status becomes running, you can access it on http://localhost:5555
.
There are three main objects in this project. Below are the endpoints to do the CRUD operations.
api/ogcisum/samples?mode=read
api/ogcisum/samples?mode=create&sampleType=${sampleType}&sampleName=${sampleName}
${sampleType}
— the instrument of the sample.${sampleName}
— the name of the sample.
api/ogcisum/samples?mode=update&sampleType=${sampleType}&sampleName=${sampleName}&id=${id}`
${sampleType}
— the instrument of the sample.${sampleName}
— the name of the sample.${id}
— the id of the sample.
api/ogcisum/locations?mode=read
api/ogcisum/samplesToLocations?mode=read
api/ogcisum/samplesToLocations?mode=create&sampleID=${sampleID}&locationID=${locationID}
${sampleID}
— the id of the sample.${locationID}
— the id of the location.
api/ogcisum/samplesToLocations?mode=delete&id=${relID}
${relID}
— the id of thesamplesToLocations
object.