Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/balasl342/api-security

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/balasl342/api-security

  • v0.0.0-20240813145217-dbc9966961e4
  • Source
  • Go
  • Socket score

Version published
Created
Source

API Security

A simple Go API with JWT authentication, rate limiting, and real-time endpoints. This API demonstrates basic security practices and provides two functional endpoints to check the rate-limiting: /current-time and /echo.

Project Structure

  • /cmd: Contains the entry point of the application.
  • /internal: Contains internal application logic including:
    • /config: Configuration loading (e.g., from .env files).
    • /handlers: HTTP request handlers.
    • /middleware: Middlewares for authentication and rate limiting.
    • /services: Utility functions, such as JWT handling.
  • /pkg: Contains packages used across the application, such as Redis client setup.

Getting Started

Prerequisites

  • Go (version 1.16 or later)
  • Redis server (can be run locally or use a hosted service)
  • Docker (optional, for running Redis in a container)

Installation

  1. Clone the repository:

    git clone https://github.com/balasl342/api-security.git
    cd api-security
    
    
  2. Install Dependencies:

    go mod tidy
    
    
  3. Create a .env file in the root directory and add your environment variables:

    SECRET_KEY=your_secret_key
    
    
  4. Set up Redis: Note : Ensure Redis is running locally on the default port (6379) or use the docker.

    docker run -d --name redis -p 6379:6379 redis
    

Running the Application

  • go run cmd/main.go

FAQs

Package last updated on 13 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc