Cake Store RESTful API is a backend application built using Go programming language and MySQL database. It provides a set of endpoints to manage cake data in a cake store. With this API, you can perform operations such as retrieving all cakes, getting a cake by ID, adding a new cake, updating an existing cake, and deleting a cake.
This API follows RESTful guidelines and is designed to be scalable and easy to use. It leverages the power of Go to provide efficient and high-performance data operations. The MySQL database is used to store and retrieve cake data.
I do not hide some files for grading purposes
-
Clone the repository:
git clone https://github.com/arizkinewbie/TECHTEST_BE.git
-
Navigate to the project directory:
cd TECHTEST_BE
-
Install the dependencies:
go mod tidy
-
Set up the database:
-
Create a MySQL database for the application. Berikut adalah struktur SQL untuk tabel "cakes":
Field Type Null Key Default Extra id INT NO PRIMARY None AUTO_INCREMENT title VARCHAR(255) NO None description TEXT YES NULL rating FLOAT YES NULL image VARCHAR(255) YES NULL created_at DATETIME YES CURRENT_TIMESTAMP DEFAULT_GENERATED updated_at DATETIME YES CURRENT_TIMESTAMP DEFAULT_GENERATED deleted_at DATETIME YES NULL -
Update the database configuration in the
.env
file.
-
-
Run the application:
go run main.go
-
The API will be accessible at
http://localhost:8080
.
Use a tool like Postman to send HTTP requests to the API endpoints.
Method | Endpoint | Description |
---|---|---|
GET | /cakes | Get all cakes |
GET | /cakes/{id} | Get a cake by ID |
POST | /cakes | Add a new cake |
PUT | /cakes/{id} | Update a cake |
DELETE | /cakes/{id} | Delete a cake |
API Name | Link |
---|---|
Cake Store RESTFul API |
Deployment URL : https://steam-mantis-381321.et.r.appspot.com/