Welcome to the backend server for our video streaming site! The server is made with Express.js and MongoDB Aggregation pipelining. Mongoose was the framework used for data models and it follows the MVC pattern structure to provide a robust platform and secure server for users to interact with video content, create playlists, engage in community discussions, and much more.
Our backend server offers the following features:
- User authentication: Users can sign up, log in, and manage their accounts securely.
- Users can also subscribe to other channels or become a channel.
- Video upload: Users can upload videos to the platform using the Multer library.
- CRUD operations on videos: Users can create, read, update, and delete videos.
- Uploaded videos, avatars, and cover-photos are stored publicly using Cloudinary.
- Playlist management: Users can create playlists, add videos, and manage playlist contents.
- Community posts: Users can create posts, engage in discussions, and interact with other users' posts.
- Comments and likes: Users can comment on videos, and posts, and engage with content by liking them.
- Use of cookies and JWT for added security measures.
Before setting up the server, ensure you have the following prerequisites:
- Node.js and npm installed on your system.
- MongoDB installed and running.
- An internet browser for testing API endpoints (e.g., Postman).
To install the backend server, follow these steps:
- Clone the repository:
git clone https://github.com/yourusername/video-streaming-backend.git
- Navigate to the project directory:
cd video-streaming-backend
- Install dependencies:
npm install
- Configuration Before running the server, you need to configure the environment variables. Create a .env file in the root directory of the project and add the following variables:
PORT = 8000
MONGODB_URI = mongodb://localhost:27017
CORS_ORIGIN= <congifure your sites>
ACCESS_TOKEN_SECRET= <add an access token, example: SUPERSECRET1234>
ACCESS_TOKEN_EXPIRY= <add an expiry date, example : 1d>
REFRESH_TOKEN_SECRET= <add a refresh token of your own>
REFRESH_TOKEN_EXPIRY= <add an expiry date, example: 10d>
#create a cloudinary account of your own and add the credentials accordingly.
CLOUDINARY_CLOUD_NAME= <cloudinary name>
CLOUDINARY_API_KEY= <paste it from your cloudinary account>
CLOUDINARY_API_SECRET= <paste it from your cloudinary account>
To start the server, run the following command:
npm start
Once the server runs, you can start making API requests to interact with the platform.
The backend server follows RESTful API principles, allowing the front-end to make proper calls to the server. The API URL's can be accessed in the routes folder of each collection type.