This is an Event App endpoint. It is built using Express.js and mongoDB. This API interacts with the MONGODB database through prismajs in order to manage and organize data.
To start using the Event App API, you'll need to understand the available endpoints and how to interact with them. This documentation provides detailed information on each endpoint, including request and response formats.
Before this project can be executed, there are some dependencies that need to already be installed on your system which are
- node and npm
- Creating a mongodb database and extracting your URI and check how to use URI String below
-
Clone the repository to your local machine
git clone https://github.com/yourusername/event-app-api.git
-
Navigate to the folder you cloned it into
cd folder-name
-
Install all the dependencies that comes with the project
npm install
To run the project, we will use the nodemon dependency (which already comes with the project)
nodemon server.js
Then go to http://localhost:9000
where the api will be available
- Create a .env file and add the following as key: value
- PORT: 9000 (can be any port example: 3000)
- DATABASE_URL: your MONGODB database URI
In the project, there is a folder called "prisma" which has the "schema.prisma" file in it. This is the file where the models are created. The following are the steps in creating and implementing prisma
-
Install prisma
npm install prisma
-
Set up prisma project using the command below, the change the provider of datasource to mongodb and you are set.
npx prisma init
-
The above step not only create the prisma file but also generates an .env and a .gitignore file. In the env file, there is an already generated database_url, change it to your mongodb url
-
Install @prisma/client
npm install @prisma/client
-
Whenever you update the prisma schema (e.g when creating a model), run the below command to update your prisma/client
npx prisma generate
Note: All these packages have been included in this project. Hence, there is no need to reinstall.