an exclusive API for wallpaperCollectApp. you can login,register,collect image,update profile in this API. I use MySQL for database with using GORM for manipulate relation of database and also Gin Framework for build this API. I deploy this API in https://wallpapercollectapi-production-c728.up.railway.app/. feel free to feedback this API.
-
Make sure you have Go and SQL installed on your machine.
-
Clone the repository to your local machine:
Copy code
git clone https://github.com/fchrgrib/wallpaperCollectRestAPI.git
- Install the necessary dependencies:
go get -v github.com/gin-gonic/gin
go get -v github.com/jinzhu/gorm
go get -v github.com/jinzhu/gorm/dialects/sql
go get -v github.com/dgrijalva/jwt-go
- Create a .env file in the root of the project and set your JWT secret key:
JWT_SECRET=yoursecretkey
- Run the migration files to create the necessary tables in the SQLite database:
go run migrations/*.go
- Start the server:
go run main.go
- The API will be running on http://localhost:8080. Use a tool like Postman to test the endpoints.
POST
/register-email-default: Register a new userPOST
/login-email-default: Login and get a JWTGET
/logout : logoutGET
/login-google-sessionGET
/register-goolgle-sessionGET
/login-facebook-sessionGET
/register-facebook-session
GET
/wallpaper: Get a list of all wallpapersPOST
/wallpaper/upload: Upload a new wallpaperGET
/wallpaper/profile: to get all user infoPUT
/wallpaper/profile/update_profile: for updating your profilePUT
/wallpaper/profile/upload_profile_picture: to upload your profile pictureGET
/images/:idGET
/images/:id/downloadDELETE
/images/:id/delete