This is a backend implementation of Sharpic.
The sharpic server manages user account information and provides login logout API. And by providing album and image api, it serves as a relay so that users can upload images to the database and super resolution processing can operate.
To use full sharpic service, see sharpic
docker compose -f ./docker-compose-test.yml up --build -dThe overall process of sharpic server is as above. Below are the modules of sharpic server.
main.go : API paths are defined and appropriate handlers are called.
/handler : Parse the json data and do whatever you need. If you need to call the DB, call the database module.
/database : Connects the database and provides necessary functionality.
/type: Data types used in sharpic server are defined.
This is a format of the request and response of the Sharpic server.
- /singup - POST
- /login - POST
- /logout - POST
- /user - GET
- /album/list - GET
- /album/:albumId - GET
- /album/new - POST
- /image/:imageId - GET
- /image/processed/:imageId - GET
- /image/info/:imageId - GET
- /image/new/:albumId - POST
- /image/up/:imageId/:newUp - PATCH
To make a request to sharpic-server, you must first log in.
Below are the APIs related to login.
{
"username": "username",
"password": "password",
"email": "email@email.com",
}{
"status": "signup success",
}{
"username": "username",
"password": "password",
"email": " ",
}{
"status": "login success",
}{
"status": "logout success",
}Provides functions related to user information.
Check userId in cookie.
{
"username": "username",
"email": "email@email.com",
}Check userId in cookie.
{
"list": [
{
"id": "int",
"username": "username",
"title": "title",
"imageIds": "[]int",
}
],
}Check userId in cookie.
{
"username": "username",
"title": "title",
"imageIds": "[]int",
}{
"username": "username",
"title": "title",
}{
"status": "new album success",
}Check userId in cookie.
Content-Type: image/png
Check userId in cookie.
Content-Type: image/png
Check userId in cookie.
{
"fileName": "string",
"size": "int64",
"added_date": "time.Time",
"up": "int",
"status": "bool",
}Form-data format
"images": image_file,
"images": image_file,
"images": image_file,
...{
"status": "images uploaded!"
}Just check the cookie.
{
"status": "up changed"
}