This small project is an HTTP web server on port 8080 that exposes endpoints for the purpose of exercise. Includes API documentation with Swag exposed on /swagger
A MySQL database server should be running locally with a jikkodb database, which should have the user table and a jikkouser user identified by jikkopass. It is possible to import the jikkodb.sql script on the jikkodb database to create and fill the user table.
Run go build
to compile, and then ./jikko-golang
to run the server
Alternatively, use go run main.go
After adding more API docs remember to use swag init -g main.go
before build/execution to update the documentation
Presents API documentation for the other endpoints
This endpoint serves POST requests with the following JSON body:
{
"unsorted": [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
}
This should give a 200-status JSON response of
{
"unsorted": [9, 8, 7, 6, 5, 4, 3, 2, 1, 0],
"sorted": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
}
If there is any missing or incorrect data, it will return a 400 status code with the message:
Incorrect or missing data in request body
This endpoint serves either GET/POST requests, responding with an HTML page that displays a form to search user by id, and lists all the users in the database below
This endpoint serves either GET/POST requests, responding with an HTML page that displays the user detail page for the user identified by the provided index id (integer) as a URL parameter