Our project is organized into several key directories:
- Controllers: This directory contains the logic for handling requests and responses. It's where we define our app's behavior in response to user actions.
- Routes: This directory is responsible for routing the app's requests to the correct controller functions.
- Models: This directory contains the data models for our app. These models define the structure of our data and interact with the database.
- Utilities: This directory contains various utility functions and helpers that are used throughout the app.
- Services: This directory contains business logic, or code that isn't directly related to receiving requests and sending responses.
- app.js: This is the main file that starts our server and contains the middleware for our app.
- server.js: This file is responsible for setting up and starting our Express server.
- schema: This directory contains the Prisma schema file, which defines our database schema and models.
I hope this gives you a clear understanding of our project's structure and the technologies used. If you have any questions, feel free to ask.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
Ensure you have Node.js installed on your machine. If not, you can download it from (https://nodejs.org/en/download/).
- Clone the repository
https://github.com/MettaSurendhar/Met-Social-Media-API.git
- Navigate into the project directory
cd Met-Social-Media-API
- Install the project dependencies
npm install
or else try
npm install --force
The npm install
command is used to install all the project dependencies listed in the package.json
file. It downloads the packages and their respective versions and saves them in the node_modules
directory.
This project uses Prisma as an ORM and PostgreSQL as the database. To set up the database, you need to update the .env
file with your database link.
The .env
file is a type of configuration file in Node.js that allows you to store environment variables. In this project, it's used to store the database connection string.
DATABASE_URL="postgresql://user:password@localhost:5432/mydb?schema=public"
Replace user
, password
, localhost
, 5432
, and mydb
with your PostgreSQL credentials and database name.
To push changes to the database, you can use the npm db-push
command.
npm db-push
The npm db-push
command is a Prisma command that updates the database schema to match the Prisma schema. It's useful for prototyping and local development but should be used with caution in production.
To start the server, use the npm start
command.
npm start
The npm start
command is a predefined script in the package.json
file that starts the application. In this project, it starts the Node.js server.
The API provides several endpoints for managing social media data. For detailed information about the endpoints, refer to the API documentation. All the endpoints are available in our Postman public workspace. Here is the postman link
We encourage everyone to contribute to our project. Here's how you can do it:
- Fork the repository on GitHub
- Clone the forked repository
- Create a new branch
- Make your changes
- Commit and push your changes
- Create a Pull Request
- Code Review
- Merge
After the code review, your changes will be merged into the main codebase.We appreciate your contributions and look forward to seeing your work!
Contributions are welcome. Please read the contributing guide for more information.
This project is licensed under the MIT License.