Skip to content

Nikolay200669/go-ks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-ks

A simple Golang application HTTP server that listens on port 8989. The server calculate factorial of a number and return the result.

How to run the application

  1. Clone the repository
git clone https://github.com/Nikolay200669/go-ks.git && \ 
cd go-ks
  1. Run the following command to start the server:
go run main.go
curl -X POST http://localhost:8989/calculate \
  -H 'Content-Type: application/json' \
  -d '{"a": 5, "b": 3}'

Or

  1. Use integration test:
go test -v ./...

output should be:

=== RUN   TestCalcHandler
=== RUN   TestCalcHandler/Run_test_OK
=== RUN   TestCalcHandler/Run_test_middleware
--- PASS: TestCalcHandler (0.00s)
    --- PASS: TestCalcHandler/Run_test_OK (0.00s)
    --- PASS: TestCalcHandler/Run_test_middleware (0.00s)
PASS
ok      github.com/Nikolay200669/go-ks  0.335s

Or

  1. Run Docker:
docker build -t go-ks . && \
docker run go-ks

TODO:

  • Add unit tests
  • Refactor for use better practices (structs, interfaces, etc...)
  • Logging
  • Use environment variables
  • Refactor struct response
  • Graceful shutdown
  • Add GitHub Actions

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published