Giter VIP home page Giter VIP logo

xm-golang-exercise's Introduction

Description

This is a test task for REST service

Linter

Install golangci-lint

$ cd $PROJECT_ROOT
$ make lint

Run tests

$ cd $PROJECT_ROOT
$ make test

Build && Run

docker-compose up --build -d --remove-orphans

Known problems

if api didn't start, just restart it

docker-compose up -d

Examples

Generate JWT

docker exec -it xm-golang-exercise-api-1 /go/bin/tokengen

Create company

curl -vvv -s -X POST \
  -H 'Authorization: Bearer **TOKEN**' \
  -d '{"name": "ltd", "code": "007", "country": "md", "website": "http://google.com", "phone": "+995987655443"}' \
  http://localhost:8088/api/v1/companies

Delete company

curl -vvv -s -X DELETE \
  -H 'Authorization: Bearer **TOKEN**' \
  http://localhost:8088/api/v1/companies/ab030400-f554-495a-83a5-44c8d66be239

Get company

curl -vvv -s http://localhost:8088/api/v1/companies/3997db3d-f747-4f00-adf8-1d2c71d2a911

Get list of companies (using search)

curl -vvv -s -X POST \
  -d '{"companies_ids":["03da6341-950d-48a5-978c-9d53f155806a", "2025f015-e548-4620-a599-ff7ed3221b4f", "foo"]}' \
  http://localhost:8088/api/v1/search/companies

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.