Giter Club home page Giter Club logo

go-fruits-api's Introduction

Fruits API

A simple Fruits REST API built in golang using Labstack's Echo.

  • For RDBMS(PostgreSQL,MySQL/MariaDB) demo use the main branch
  • NoSQL(MongoDB) please switch to mongodb branch.

Pre-requisites

Environment Setup

Copy the .env.example to .env and update the following variables to suit your settings.

  • PLUGIN_REGISTRY - the docker registry to use
  • PLUGIN_TAG - the tag to push the image to docker registry
  • PLUGIN_REPO - the docker registry repository
  • PLUGIN_USERNAME - the docker Registry username
  • PLUGIN_PASSWORD - the docker registry password

Backend Database to use

  • FRUITS_DB_TYPE - the database to use with fruits api, defaults: sqlite

Postgresql DB Settings

  • POSTGRES_HOST - the postgresql host usually the docker or kubernetes service name e.g. postgresql
  • POSTGRES_PORT - the postgresql port e.g. 5432
  • POSTGRES_USER - the postgresql user e.g. demo
  • POSTGRES_PASSWORD - the postgresql password e.g pa55Word!
  • POSTGRES_DB - the postgresql database to use e.g demodb

MariaDB/MySQL Settings

  • MYSQL_HOST - the MySQL host usually the docker or kubernetes service name e.g.mysql
  • MYSQL_PORT - the MySQL port e.g. 3306
  • MYSQL_ROOT_PASSWORD - the MySQL root password superS3cret!
  • MYSQL_PASSWORD - the MySQL password pa55Word!
  • MYSQL_USER - the MySQL user e.g demo
  • MYSQL_DATABASE - the MySQL database to use e.g demodb

SQLite

  • FRUITS_DB_FILE - the default database file to use.

NOTE:

  • Most of the above database settings comes from how you setup the datbase. Please update accordingly
  • If you use FRUITS_DB_FILE to use for testing.

Build the Application

Set the FRUIT_DB_TYPE to pgsql or mysql to run tests against those databases. As by default all the tests are performed against SQLite.

drone exec --trusted --env-file=.env

The command will test, build and push the container image to the $PLUGIN_REPO:$PLUGIN_TAG.

Run Application

Locally

docker-compose up

Testing

The application provides a Swagger UI that can be used to used to play with the API.

go-fruits-api's People

Contributors

kameshsampath avatar jalagars 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.