A movie streaming backend
Clone the project
gh repo clone WatchMe-2-0/watchmeGo to the project directory
cd watchmeInstall dependencies
go mod tidyBefore starting the server run
docker-compose upBy running this
minio-storagepostgres-dbthese twocontainerwill start locally for
minio
http:localhost:9001-- minio client web uihttp:localhost:9000-- minio server api
postgres-db
http:localhost:5432
This are the basic yml written in docker-compose.yml
for postgres
environment:
POSTGRES_USER: admin
POSTGRES_PASSWORD: admin
POSTGRES_DB: moviesdb`for minio
environment:
MINIO_ROOT_USER: admin
MINIO_ROOT_PASSWORD: admin123and there is an app.env file which will you need to configure by going to
Go here
http://localhost:9001/access-keys
and create the accesskeys
add the keys accordingly in example.env and also rename the example.env to app.env
THIS IS IMPORTANT!!!
using curl
To uploading movies
Post http://localhost/upload
curl -X POST http://localhost:8000/upload \
-F "title=Interstellar" \
-F "movie=@/path/to/interstellar.mp4" \
-F "poster=@/path/to/interstellar.jpg"To Get all movies
Get http://localhost:8000/movies
curl -X GET http://localhost:8000/moviesTo stream the movie
GET http://localhost:8000/stream/:name
curl -X GET http://localhost:8000/stream/1741891860-interstellar.mp4To delete
delete curl -X DELETE http://localhost:8000/movies/{movie.id}
to know the ID use
curl -X GET http://localhost:8000/movies
output
{"ID":4, -- this is the ID
"Title":"alooposto",
"PosterURL":"http://localhost:8000/posters/1741891860-7a32830bdcf1dc41e5245d6a944406a2.jpg",
"StreamURL":"http://localhost:8000/stream/1741891860-alooposto.mp4",
"CreatedAt":"2025-03-14T00:21:00.976905+05:30"}