This project is a simple note taking app that allows users to create, read, update, and delete notes. The app uses an golang backend.
This project uses a repository pattern. Why use a repository pattern?
- Flexibility when there is a change in the naming of a table field or a change in the database schema
- Flexibility when we decide to change ORM, QueryBuilder, or database
- Ease of finding errors during development
Because I'm separating the business logic and persistence/request logic
-
API Layer (Controller)
The API layer is a REST API that provides an interface for interacting with applications -
Service Layer
The Service layer is responsible for handling the application's business logic. -
Repository Layer
The Repository layer is responsible for handling persistence logic. This layer is responsible for sending requests to the database.
- On your computer open the console/command prompt
- Enter the Following Command
git clone https://github.com/milhamap/simple-note.git
- Enter the Clone Results Folder
cd simple-note
- Install Golang Terlebih Dahulu
Download disini - Install all golang dependecies Terlebih Dahulu
$ go get
- Create a new database in phpmyadmin with the name
simple_note
for application database andsimple_note_test
for testing database - Migration database using
golang migrate
for application database
$ migrate -database "mysql://root@tcp(localhost:3306)/simple_note" -path db/migrations up
- Migration database using
golang migrate
for testing database
$ migrate -database "mysql://root@tcp(localhost:3306)/simple_note_test" -path db/migrations up
- Open the terminal/command prompt
- Enter the Following Command
$ go run main.go
You can access this project API documentation at test.http