api

command module
v0.0.0-...-5d71aee Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2024 License: MIT Imports: 6 Imported by: 0

README

Shopping API

This project is a Shopping API built with Go, using the Gin framework and Okta for authentication.

Setup and Installation

Prerequisites
  • Go (version 1.23.3 or later)
  • Git
Clone the Repository
git clone https://github.com/ShoppingDem/api.git
cd apigo get -u github.com/gin-gonic/gin
Install Dependencies
go get -u github.com/swaggo/swag/cmd/swag
go get -u github.com/swaggo/gin-swagger
go get -u github.com/swaggo/files
go get -u github.com/okta/okta-jwt-verifier-golang
go get -u github.com/joho/godotenv
Generate Swagger Documentation

swag init

Set Up Environment Variables

OKTA_ISSUER=https://{yourOktaDomain}/oauth2/default OKTA_CLIENT_ID={yourClientId}

Build and Run

go build -o api ./api

API Documentation
Security

This API uses Okta for authentication. All protected endpoints require a valid Okta token to be included in the request header.

GET /api/protected HTTP/1.1 Host: localhost:8080 Authorization: Bearer your_okta_token_here

Replace your_okta_token_here with a valid Okta token.

Swagger Documentation

http://localhost:8080/swagger/index.html

Additional Information

This README.md file now includes all the necessary information for setting up the project, understanding the API documentation, and using the authentication system. The security definitions from the selected code are incorporated into the "API Documentation" section.

Documentation

Overview

Package main provides the main entry point for the Shopping API

Directories

Path Synopsis
Package docs Code generated by swaggo/swag.
Package docs Code generated by swaggo/swag.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL