Welcome to the repository for Hover Creaft: Video Streaming! This project is a backend implementation for a standalone and lightwight video streaming, where you can upload, check the status and watch streaming of videos.
Since this solution is intended as portfolio, it uses In-Memory MongDB database to not require any extra installation other than the Node.js, however, all the MongoDB connection is setup in the AppModule, and if changed to a connection the rest of the transactions would still follow the new setup.
To use this solution, follow the instructions:
- Clone the repository:
git clone https://github.com/GiovaniRizzato/streaming-backend
- Download the dependencies:
npm install
- Run the aplication:
npm run start
- Access the endpoints with http://localhost:3000/, by default
The solution has a Swagger using the http://localhost:3000/api/ endpoint and the steps of Using this solution section.
Method | URL | Request Body | Response Body | Description |
---|---|---|---|---|
GET |
/video |
Array of Info DTO | Retrieve informations from all listed videos. | |
GET |
/video/{id} |
Info DTO | Retrieve all video informations with {id}. | |
PUT |
/video/{id} |
New info DTO | Info DTO | Update informations for video with {id}. |
POST |
/video |
New info DTO + File | Info DTO | Upload new video. |
GET |
/video/watch/{id} |
Request the video streaming with {id}. It'll throw an error if the video is not available |
{
title: string,
isStreamAvalible: boolean,
isListed: boolean
}
{
id: number,
title: string,
isStreamAvalible: boolean,
isListed: boolean
}
All the tests implementation are in "E2E" format to ensure testing accuracy, and can be found in test/app.e2e-spec.ts.
PASS test/app.e2e-spec.ts (18.842 s)
AppController
√ should return an empty list when no videos had been uploaded yet (1360 ms)
should be able to upload a new video
√ should be included listed (1680 ms)
√ should be able to view the info by id (1436 ms)
√ should be able to watch the video (1658 ms)
should be able to edit the video information (to not listed, nor avalible to watch)
√ should NOT included listed after changing it to unlisted video (1492 ms)
√ should be still able to view the info by id, even when not watchable nor listed (1640 ms)
√ should NOT be able to watch the video after changing it to not be avalible (1363 ms)