Skip to content
Snippets Groups Projects
Select Git revision
  • d877745fcbbfe204ff5b0793aea50bfd45d38b2d
  • main default protected
  • k8s
3 results

myaktion-go-ss2023

  • Open with
  • Download source code
  • Your workspaces

      A workspace is a virtual sandbox environment for your code in GitLab.

      No agents available to create workspaces. Please consult Workspaces documentation for troubleshooting.

  • Name Last commit Last update
    k8s
    src/myaktion
    README.md
    docker-compose.yml
    go.work

    Start

    Start the server:

      # cd src/myaktion && go run main.go

    Build, Start and Stop service using Docker Compose

      # docker compose build
      # docker compose up
      # docker compose down

    Use the REST API

    Add a campaign

      # curl -H "Content-Type: application/json" -d '{"name":"Covid","organizerName":"Martin","donationMinimum":2,"targetAmount":100,"account":{"name":"Martin","bankName":"DKB","number":"123456"}}' localhost:8000/campaign

    Get campaign data

    To retrieve all the persisted campaign objects, send this GET request:

      # curl localhost:8000/campaigns

    For retrieving just a specific campaign, append the campaign's ID. E.g. for retrieving the campaign with ID 1, call:

      # curl localhost:8000/campaigns/1

    Delete a campaign

    The following command deletes the campaign with ID 1:

      # curl -X DELETE localhost:8000/campaigns/1

    Update a campaign

    The following command updates the campaign with ID 1:

      # curl -X PUT -H "Content-Type: application/json"  -d '{"name":"Corona","organizerName":"Marcus","donationMinimum":2,"targetAmount":100}' localhost:8000/campaigns/1

    Add a donation to a campaign

    This command adds a donation to the campaign with ID 1:

      # curl -H "Content-Type: application/json" -d '{"Amount":20,"donorName":"Martin","receiptRequested":true,"status":"IN_PROCESS","account":{"name":"Martin","bankName":"DKB","number":"123456"}}' localhost:8000/campaigns/1/donation