this Project is base project about restfull API and MySQL

Requirements.

  • This project only supports to run on Ubuntu currently
  • go version >= 1.16
  • docker
  • docker-compose

Install Protobuffer

Install Docker & docker-compose.

Start docker-compose to run MySQL database & KeyStone.

$cd docker
$docker-compose up -d

Build & Run mini_project.

$make
$./mini_project

How To test

  1. login: run login by terminal windows:

Note: For generating a base64 string for user: admin, pass: abc123
$ echo -ne "admin:abc123" | base64
YWRtaW46YWJjMTIz
- Endpoint: /api/v2/auth/login
- Example:
    curl -i -X POST -H "Authorization: basic YWRtaW46YWJjMTIz" http://localhost:8080/api/v2/auth/login
  1. assign OS_TOKEN=Key_got_from_above:

- Example: OS_TOKEN=eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJzdWIiOiIwMTgwNjVmNjlkYTY0MTgzYjNmNDc5MDAwMWRkOWE5ZSIsImlhdCI6MTYzNzUwNjY4NSwiZXhwIjoxNjM3NTEwMjg1LCJvcGVuc3RhY2tfbWV0aG9kcyI6WyJwYXNzd29yZCJdLCJvcGVuc3RhY2tfYXVkaXRfaWRzIjpbIk5GbTRKWFBSVHBXRVowdlpFWHgzX0EiXSwib3BlbnN0YWNrX3Byb2plY3RfaWQiOiIzYThlZGMyZDcwMDE0NmViOWVjMGQyZjM1M2YxMjQ3ZiJ9.DKJzr82g6My4z3FoshegAvlz1zF1yiZSCMJ-RQL9LP7yLxjYE4Oy107zBsqDBZ9cQHEn0cT66V2pzMhTwyXrjQ
  1. Create new User:

- Endpoint: /api/v2/auth/users
- Example:
    curl -X POST -H "Authorization: bearer $OS_TOKEN" -H "Content-Type: application/json" -d '{"name": "newuser1", "password": "changeme", "enaled": true, "email" : "test123@123", "phone": "123456","number_task":"10"}' "http://localhost:8080/api/v2/auth/users" | jq '.'
  1. Get the List of User ID:

- Endpoint: /api/v2/auth/userids
- Example:
    curl -X GET -H "Authorization: bearer $OS_TOKEN" -H "Content-Type: application/json" "http://localhost:8080/api/v2/auth/userids" | jq '.'
  1. Update user:

- Endpoint: /api/v2/auth/users/{user_id}
- Example:
curl -X PATCH -H "Authorization: bearer $OS_TOKEN" -H "Content-Type: application/json" -d '{"user_name" : "test", "email": "test@test", "phone": "0904123456","number_task":12}' http://localhost:8080/api/v2/auth/users/aae669b279cd4cf999b85a57d93ffc83 | jq '.'
  1. Create new Task for user:

- Endpoint: /api/v1/newtask
- Ex: $ curl -s -H "Authorization: Bearer $OS_TOKEN" -H "Content-Type: application/json" -d '{"user_id":"aae669b279cd4cf999b85a57d93ffc83","task_name": "task3"}' http://localhost:8080/api/v1/newtask | jq '.'
Owner
Quang
Senior Developer specializing in back end development. Experienced with all stages of the development cycle for software projects.
Quang
Similar Resources

Moby Project - a collaborative project for the container ecosystem to assemble container-based systems

Moby Project - a collaborative project for the container ecosystem to assemble container-based systems

The Moby Project Moby is an open-source project created by Docker to enable and accelerate software containerization. It provides a "Lego set" of tool

Jan 8, 2023

A simple project (which is visitor counter) on kubernetesA simple project (which is visitor counter) on kubernetes

k8s playground This project aims to deploy a simple project (which is visitor counter) on kubernetes. Deploy steps kubectl apply -f secret.yaml kubect

Dec 16, 2022

Using the Golang search the Marvel Characters. This project is a web based golang application that shows the information of superheroes using Marvel api.

Using the Golang search the Marvel Characters. This project is a web based golang application that shows the information of superheroes using Marvel api.

marvel-universe-web using the Golang search the Marvel Universe Characters About The Project This project is a web based golang application that shows

Oct 10, 2021

This project will help you to create Live img.shields.io Badges which will Count YouTube Stats (Subscriber, Views, Videos) without YouTube API

This project will help you to create Live img.shields.io Badges which will Count YouTube Stats (Subscriber, Views, Videos) without YouTube API

Free YouTube Stats Badge This project will help you to create Live img.shields.io Badges which will Count YouTube Stats (Subscriber, Views, Videos) wi

Oct 11, 2022

Simple project by Follow up Question from LINE MAN Wongnai about summary covid stats from API.

Simple JSON API to summarize COVID-19 stats API created by Follow-up Question from LINE MAN Wongnai. they can show summary covid stats from Province a

Feb 19, 2022

WIP - Pin - local pipeline project with Docker Golang API.

WIP - Pin - local pipeline project with Docker Golang API.

pin 🔥 WIP - Local pipeline project with Docker Golang API. 🌐 Installation Download latest release You can download latest release from here Install

May 28, 2022

Kubernetes OS Server - Kubernetes Extension API server exposing OS configuration like sysctl via Kubernetes API

KOSS is a Extension API Server which exposes OS properties and functionality using Kubernetes API, so it can be accessed using e.g. kubectl. At the moment this is highly experimental and only managing sysctl is supported. To make things actually usable, you must run KOSS binary as root on the machine you will be managing.

May 19, 2021

A shields.io API for your youtube channel to protect your api key

A shields.io API for your youtube channel to protect your api key

Youtube-Channel-Badge A shields.io API for your youtube channel to protect your

Dec 23, 2021

Pokete api - An API to get (Pokete, Attack etc.) data from Pokete

Pokete API An API to get (Pokete, Attack etc.) data from Pokete. Usage To lauch

Jun 16, 2022
This action prints "true" if image is required to update based on the base image update.

container-image-updater This action prints "true" if image is required to update based on the base image update. Inputs Name Type Description base-ima

Apr 15, 2022
Repositório base p/ tema12 da trilha de DevOps.

tema12--Jenkins Informações Repositório base: https://github.com/brazdore/ilegra-devops-tema12.git Requisitos Jenkins Docker Packer JDK 11 ou maior Pr

Dec 21, 2021
Projeto base de estudo da GoLang - Curso Alura

Go Projeto desenvolvido durante o curso de Go da Alura. Esse curso tem como objetivo conhecer os princípios básicos da linguagem Go. Requisitos Ter o

Jan 19, 2022
Chat - Console mode chat done in Go, PHP and MySQL

Chat modo consola hecho en GO y PHP(https://github.com/RicardoValladares/AJAX) G

Nov 10, 2022
cluster-api-state-metrics (CASM) is a service that listens to the Kubernetes API server and generates metrics about the state of custom resource objects related of Kubernetes Cluster API.

Overview cluster-api-state-metrics (CASM) is a service that listens to the Kubernetes API server and generates metrics about the state of custom resou

Oct 27, 2022
Docker LNMP (Nginx, PHP7/PHP5, MySQL, Redis)

DNMP(Docker + Nginx + MySQL + PHP7/5 + Redis)是一款全功能的LNMP一键安装程序。 使用前最好提前阅读一遍目录,以便快速上手,遇到问题也能及时排除。

Jan 1, 2023
Kubernetes Operator for MySQL NDB Cluster.

MySQL NDB Operator The MySQL NDB Operator is a Kubernetes operator for managing a MySQL NDB Cluster setup inside a Kubernetes Cluster. This is in prev

Dec 21, 2022
Run the mysql container standalone

Run the mysql container standalone docker container run -v "//c/Users/javier/Goo

Dec 21, 2021
A seed repository that contains a Go project that accepts input via a REST API and saves data to an Oracle database.

rest-oracle-go-seed A seed repository that contains a Go project that accepts input via a REST API and saves data to an Oracle database. Why Oracle? T

Apr 18, 2022