Skip to content

Nezz7/sum-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sum API

A lightweight Go HTTP server that calculates the sum of two numbers.

Build & Run

# Run the server
make run

# Run linting and formatting
make lint

# Run tests with benchmarks
make test

# Run tests with coverage
make coverage

# Run SAST (Static Application Security Testing)
make sast

# Run DAST (Dynamic Application Security Testing)
make dast

# Test API endpoints
make curl

# Build the application
make build

# Clean build artifacts
make clean

API Documentation

Endpoints

GET /sum

Calculates the sum of two numbers.

Parameters:

  • a (required): First number
  • b (required): Second number

Example:

curl "http://localhost:8080/sum?a=5&b=3"

Response:

{"result": 8}

Error Responses:

  • 400 Bad Request: Missing or invalid parameters
    {"error": "missing parameter 'a'"}
  • 400 Bad Request: Integer overflow
    {"error": "integer overflow: 9223372036854775807 + 1 exceeds maximum value"}
  • 405 Method Not Allowed: Invalid HTTP method
    {"error": "method not allowed"}

About

A lightweight Go HTTP server that calculates the sum of two numbers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published