Code Monkey home page Code Monkey logo

jikko-golang's Introduction

Jikko-Golang

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

Requirements

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.

Compilation and Execution

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

Endpoints

/swagger/index.html

Presents API documentation for the other endpoints

/arrays

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

/users

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

/users/{id}

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

jikko-golang's People

Contributors

jcalvarezj avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.