Code Monkey home page Code Monkey logo

benzinga-webhook-receiver's Introduction

Benzinga Webhook Receiver

Overview

The Benzinga Webhook Receiver is a Go application designed to receive and process webhook requests. It features two primary endpoints:

  • /healthz for health checks
  • /log for logging JSON data received via POST requests.

Getting Started

Prerequisites

  • Docker
  • Go 1.17 (for local development and testing)
  • Git (for version control)

Installation

Clone the repository:

git clone https://github.com/lamthaithanhlong/benzinga-webhook-receiver.git
cd benzinga-webhook-receiver

Building the Docker Image

Build the Docker image using the following command:

docker build -t webhook-receiver .

Running the Application

Run the application using Docker:

docker run -p 8080:8080 webhook-receiver

This command starts the webhook receiver on port 8080.

API Usage

Health Check

To check the health of the application, use the following curl command:

curl --location 'http://localhost:8080/healthz'

Posting Log Data

To post log data to the /log endpoint:

curl --location 'http://localhost:8080/log' \
--header 'Content-Type: application/json' \
--data '{
    "user_id": 1,
    "total": 1.65,
    "title": "delectus aut autem",
    "meta": {
        "logins": [
            {
                "time": "2020-08-08T01:52:50Z",
                "ip": "0.0.0.0"
            }
        ],
        "phone_numbers": {
            "home": "555-1212",
            "mobile": "123-5555"
        }
    },
    "completed": false
}'

Testing with RequestBin

You can test webhook integrations using the provided RequestBin URL:

https://webhook.site/f1eeaf82-8cc5-4a79-bcf7-00b6e530e65c

Send data to this endpoint to see how the application processes and forwards requests.

Running Tests

Linting with Golangci-lint

Run Golangci-lint to ensure the codebase adheres to linting standards:

golangci-lint run

Running Ginkgo Tests

Execute the following command to run tests recursively with verbose output:

ginkgo -r -v

Project component diagram

img_3.png

Activity Diagram

img_1.png

Sequence Diagram

img.png

Component Interaction Diagram for test case

img_1.png

Result Log

img.png

img.png

Result healthz

img.png

Security

I will implement this in near future lol!

Contributing

Contributions to the Benzinga Webhook Receiver are welcome! Please refer to the contributing guidelines before making pull requests.

License

This project is licensed under the MIT License.

benzinga-webhook-receiver's People

Contributors

lamthaithanhlong avatar

Stargazers

 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.