An open API service indexing awesome lists of open source software.

https://github.com/hrz8/gokomodo-challenge


https://github.com/hrz8/gokomodo-challenge

go golang rest-api

Last synced: about 1 month ago
JSON representation

Awesome Lists containing this project

README

          

# gokomodo-challenge
Full API Doc: [DOCUMENTATION](https://documenter.getpostman.com/view/6786432/2s8Yt1qovX) ๐Ÿ“–

## What's going on here?

- [Stack used ๐Ÿฅž](#stack-used-)
- [Before Run โ˜•๏ธ](#before-run-%EF%B8%8F)
* [Clone Repo ๐Ÿ’พ](#clone-repo-)
- [How to Run ๐Ÿ‘Ÿ](#how-to-run-)
* [Run Locally ๐Ÿƒ](#run-locally-)
* [Debugging ๐Ÿ•ต๏ธโ€โ™‚๏ธ](#debugging-%EF%B8%8F%EF%B8%8F)
* [Dockering ๐Ÿณ](#dockering-)
- [How to Use ๐Ÿ’ป](#how-to-use-)

## Stack used ๐Ÿฅž

- SQLite3
- Golang
- Echo Framework

## Before Run โ˜•๏ธ

โ—๏ธ This app needed `gcc` to run since sqlite3 library required that. Here is the article about that [here](https://7thzero.com/blog/golang-w-sqlite3-docker-scratch-image).

### Clone Repo ๐Ÿ’พ

Clone this repo using `Download` button or bash ๐Ÿ‘จโ€๐Ÿ’ป

```bash
$ git clone https://github.com/hrz8/gokomodo-challenge.git
```

## How to Run ๐Ÿ‘Ÿ

### Run Locally ๐Ÿƒ

This command below will compiling the `main.go` and all used packaged into binary file at the first and run the binary right after that.

```bash
$ make run
```

It will running in the localhost with the `3000` port given `http://localhost:3000`.

### Debugging ๐Ÿ•ต๏ธโ€โ™‚๏ธ

Debug app using VsCode Debugger Tool

- Select your debugger to be set as `Launch server`
- Press `F5` to run the debugging
- Done!

### Dockering ๐Ÿณ

- Image Builds (Example)

```bash
# build as docker image
$ make docker-build
# make sure docker image already registered
$ docker image ls
# start the container
# you will automatically see the logs of the app as well
$ make docker-start
# check endpoint
$ curl --location --request POST 'http://localhost:3000/seller/register' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "your name",
"email": "your@email.com",
"password": "password",
"address": "your address"
}'
```

- Docker Compose (Example)

```bash
# you will automatically see the logs of the app as well
$ make docker-compose
# check endpoint
$ curl --location --request POST 'http://localhost:3000/seller/register' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "your name",
"email": "your@email.com",
"password": "password",
"address": "your address"
}'
```

## How to Use ๐Ÿ’ป

This application based on RESTful API, so the usage will required to do the HTTP request to each available endpoint below. Full Documentation of how to use each endpoint is in the link right here: [DOCUMENTATION](https://documenter.getpostman.com/view/6786432/2s8Yt1qovX) ๐Ÿ“–

## Test ๐Ÿงช

Test unit.

```bash
$ make test
```

Test lint.

```bash
$ make lint
```

## Author โ„น๏ธ

Hirzi Nurfakhrian