skill-test-abishar

command module
v0.0.0-...-e893066 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2023 License: MIT Imports: 9 Imported by: 0

README

Skill test abishar

A simple RESTFUL API that provides endpoints to batch insert data.

Go

Prerequisites

Installation

  • Clone this repository.
  • Duplicate .env.example file to .env file and change the variable value with your desired value.
  • Next, run below command to migrate the database.
migrate -database "postgres://{DB_USERNAME}:{DB_PASSWORD}}@{DB_HOST}:{DB_PORT}/{DB_NAME}?sslmode=disable" -path db/migrations up 

NOTE: Replace {DB_USERNAME}, {DB_PASSWORD}, {DB_HOST}, etc with the corresponding value in your .env file.

  • Then run this command to synchronize all the dependencies.
go mod tidy
  • Finally, run the project.
go run .

Usage

Do the post request as below:

curl -X POST \
  'localhost:{PORT}/sales' \
  --header 'Accept: */*' \
  --header 'User-Agent: Thunder Client (https://www.thunderclient.com)' \
  --header 'Content-Type: application/json' \
  --data-raw '{
  "request_id": 12345,
  "data": [
    {
      "id": 0,
      "customer": "Vazquez Rowland",
      "quantity": 1,
      "price": 10,
      "timestamp": "2022-01-01 22:10:44"
    }
  ]
}'

NOTE: Replace the {PORT} with your defined PORT value in your .env file.

Meta

Hanif Naufal – @Digisatahnaufal123@gmail.com

Distributed under the MIT license. See LICENSE for more information.

Contributing

  1. Fork this repository.
  2. Create your own branch (git checkout -b fooBar).
  3. Commit your changes (git commit -am 'Add some fooBar').
  4. Push to the branch (git push origin fooBar).
  5. Create your awesome Pull Request.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL