migrate -path migrations/ -database 'mysql://{user}:{password}@tcp({host}:{port})/dbname?query' -verbose up
migrate -path migrations/ -database 'mysql://{user}:{password}@tcp({host}:{port})/dbname?query' -verbose down
mysql -u user -p movie_app < migrations/seeds/*.sql
- create db name movie_app
- then run command below :
$ mysql -u {dbUser} -p movie_app < migrations/seeds/*.sql
$ go run .
- Endpoint:
/api/auth/register
- Method: POST
- Body:
{
"username": "string",
"email": "string",
"first_name": "string",
"last_name": "string",
"password": "string",
"confirm_password": "string"
}
- body:
{
"success": "boolean",
"message": "string"
}
- Endpoint:
/api/auth/login
- Method: POST
- Body:
{
"username": "string",
"password": "string"
}
- body:
{
"success": "boolean",
"message": "string",
"token": "JWT"
}
- Endpoint:
/api/movies
- Method: GET
- body:
{
"success": "boolean",
"message": [
{
"movie_id": "int"
"title": "string"
"release_year": "year"
"production": "endpoint"
"overview": "text"
},
{
"movie_id": "int"
"title": "string"
"release_year": "year"
"production": "endpoint"
"overview": "text"
},...
]
}
- Endpoint:
/api/movies/{movieId}
- Method: GET
- body:
{
"success": "boolean",
"message": {
"movie_id": "int",
"title": "string",
"year": "year",
"poster": "endpoint",
"overview": "string",
"reviews": [
{
"review_id": "int",
"username": "string",
"review": "string",
},
{
"review_id": "int",
"username": "string",
"review": "string",
},...
]
}
}
- Endpoint:
/api/movies/{movieId}/review
- Method: POST
- Body:
- body:
{
"success": "boolean",
"message": "string"
}
- Endpoint:
/api/movies/{movieId}/review/{reviewId}
- Method: PUT
- Body:
- body:
{
"success": "boolean",
"message": "string"
}
- Endpoint:
/api/movies/{movieId}/review/{reviewId}
- Method: DELETE
- body:
{
"success": "boolean",
"message": "string"
}
graph TD
A([A])-->B[/B/]
B-->C{C}
C-->|yes|D([D])
C-->|no|E([E])
Loading