https://github.com/palaszontko/go-luhn-credit-validator
Credit Card Validation Using the Luhn Algorithm in Go - Project written to practice go lang :)
https://github.com/palaszontko/go-luhn-credit-validator
go golang luhn-algorithm
Last synced: about 1 month ago
JSON representation
Credit Card Validation Using the Luhn Algorithm in Go - Project written to practice go lang :)
- Host: GitHub
- URL: https://github.com/palaszontko/go-luhn-credit-validator
- Owner: Palaszontko
- License: mit
- Created: 2024-02-27T22:21:40.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-28T16:04:13.000Z (about 1 year ago)
- Last Synced: 2025-02-09T00:15:00.624Z (3 months ago)
- Topics: go, golang, luhn-algorithm
- Language: Go
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Go Luhn Credit Card Validator
A simple Go microservice for validating credit card numbers using the Luhn algorithm.
## Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
### Prerequisites
- Go (version 1.21 or higher)
### Installing
1. Clone the repository to your local machine:
```
git clone https://github.com/Palaszontko/go-luhn-credit-validator
cd go-luhn-credit-validator
```## Usage
1. Run the server:
```
go run cmd/server/main.go
```2. Send a POST request to `http://localhost:8080/validate` with a JSON body containing the credit card number:
```json
{
"cardNumber": "4111111111111111"
}
```3. Response
```json
{
"isValid": true,
"cardNetwork": "Visa"
}
```## Running the tests
Use the following command in the project directory to run the tests:
``` bash
go test ./...
```## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details