Code Monkey home page Code Monkey logo

taylorzh-gin's Introduction

taylorzh-go

A simple monolithic app serving RESTful APIs. This repo contains some best practices that could be referred in production and learning purpose. And all the codes are original written by Yuxin Zhang ([email protected])

Building Blocks

Before start

A lot of components are used to make this server more complete and fancy. So be sure to install them as you needed.

Required components

The following components are required for you to run this app in your local environment:

MySql DB

Please refer to this address to install MySql on your local machine: https://dev.mysql.com/downloads/mysql/

Your server should be ready in the following configurations or change the Makefile to meet your settings:

ip: localhost(127.0.0.1)
port: 3306
password: 1qaz!QAZ
DB schema: taylorzh

Nice to have components

The following components are used to either improve your dev experience or to enhance the server.

Air

It's a good idea to do TDD or to verify your code in real-time. This tool offers the ability to auto rebuild and reload your app every time the file is changed. Be sure to use it to shorten the feedback loop of the dev cycle.

go install github.com/cosmtrek/air@latest

Redis

https://redis.io/docs/getting-started/

Quick Start

Run the following command to run this app on your local machine:

make dev  # if you installed air

make run  # if you don't have air

check the server is running

curl localhost:8080/healthcheck
# OK 2022-08-20T17:02:23+08:00
curl localhost:8080/hello
# {"count":1,"message":"hello world"}

Feature List

  • load counter
  • async task runner
  • logger

Load counter and metrics

Sometimes we want to load test the performance of our backend service and to collect the request metrics of the service. These apis give you the metrics of the request in various dimensions.

TODO

Async Task Runner

TODO

logger

taylorzh-gin's People

Contributors

taylorzhangyx avatar

Watchers

James Cloos avatar  avatar

taylorzh-gin's Issues

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.