Giter Club home page Giter Club logo

form-builder-service's Introduction

Go API Structure

This is a simple API structure for a Go application. The structure is designed to be modular and scalable. The structure is as follows:

  • api contains the code for the backend of the application.
  • storage contains the code for database management.
  • types contains the code for structuring the data.
  • utils contains the code for utility functions.

Entry point of the application is in the main.go file. The main.go file initializes the database and starts the server. The server is started on port 3000 by default. listenaddr parameter in the main.go file can be changed to start the server on a different port.

Benchmarking the API

wrk is a modern HTTP benchmarking tool capable of generating significant load when run on a single multi-core CPU. It combines a multithreaded design with scalable event notification systems such as epoll and kqueue. An optional LuaJIT script can perform HTTP request generation, response processing, and custom reporting.

Installation

brew install wrk

Usage

GET /questions

12 threads, 500 connections, 30 seconds

wrk -t12 -c500 -d30s --latency http://127.0.0.1:3000/questions

Connecting to Postgres running in Docker

  psql -h localhost -p 5432 -U admin -d main

INSERT INTO questions (isRequired, key, type, label) VALUES('0', 'test-key', 'text', '{ "tr": "Test Label for Turkish" }');

To Do

  • Create Question struct in the types package.
  • Add MustHaveKey method to Question struct
  • Add GetQuestion, DeleteQuestion and UpdateQuestion methods
  • Separate create and update validation functions
  • Add minimum and maximum methods to QuestionLabel struct for validation
  • Add minimum and maximum key length validation
  • Add GET method for questions
  • Add environment variables and read with https://github.com/joho/godotenv
  • Add postgres and mongodb database
  • Create Form struct in the types package.
  • add swagger documentation
    • add swagger documentation for questions
  • add CI/CD pipeline
    • add github actions
    • add dockerfile
    • add gcp cloud run deployment
  • Add validation for other question keys

form-builder-service's People

Contributors

erenhncr avatar

Watchers

 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.