Giter VIP home page Giter VIP logo

simple-survey-app's Introduction

Simple Survey App

Survey application that have some questions that can be answered

Run Application

Using go build

ensuring all dependencies with go mod download

build application with script go build main.go

run application ./main

run app with auto build go run main.go

Using docker

execute this command to run app with docker

docker-compose up --build

note that you have to ensure DB_HOST in .env are the same with host in docker-compose.yml

shutdown docker with docker-compose down --remove-orphans --volumes

Run Test

Using Docker

execute this command to run test with docker

docker-compose -f docker-compose.test.yml up --build --abort-on-container-exit

note that if you want to run test with docker, ensure that DB_HOST using the same host in docker-compose.test.yml and .env in package tests

Using Framework Go Test

execute this command to run test with go test framework

go test github.com/mariotj/survey-app/tests

API Documentation

List of all API in survey app:

  1. Create Survey

    POST /api/v1/survey

    request body

    {"name" : "desired survey name"}
    
  2. Update Survey

    PUT /api/v1/survey

    request body

    {"id": id, "name" : "desired survey name"}
    
  3. Delete Survey by id

    DELETE /api/v1/survey/:id

  4. Get survey by id

    GET /api/v1/survey/:id

  5. Get all survey

    GET /api/v1/survey

  6. Add question by survey id

    POST /api/v1/question

    request body

    {"question" : "desired question", "survey_id": id}
    
  7. Update Question by question id

    PUT /api/v1/question

    request body

    {"id": id, "question" : "desired update question"}
    
  8. Get all question by survey id

    GET /api/v1/question/survey/:id

  9. Delete question by question id

    DELETE /api/v1/question/question/:id

  10. Delete all question by survey id

    DELETE /api/v1/question/survey/:id

  11. Add answer to a question

    POST /api/v1/survey/answer

    request body

{"answer" : "desired answer", "username": "username", "survey_question_id": id}
  1. Update answer by id

    PUT /api/v1/survey/answer

    request body

{"answer" : "desired answer", "id": id}
  1. Get report for survey by survey id (including question and answer)

    GET /api/v1/report/survey/:id

simple-survey-app's People

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.