Giter Club home page Giter Club logo

go-ngrok's Introduction

Image Server with Golang and Ngrok

This project demonstrates how to create a simple image server using Golang and expose it to the internet using Ngrok. The server serves images from a local directory and allows access via Ngrok-generated URLs.

Prerequisites

Before getting started, make sure you have the following installed:

  • Golang: The Go programming language.
  • Ngrok: A tool to expose your local server to the internet.

Getting Started

  • Clone the repository

    git clone https://github.com/Sahil-4555/go-ngrok.git
    
  • Place images

    Place your image files in the "images" directory. Ensure your images have extensions like .jpg, .jpeg, or .png.

  • Run the server

    go run main.go
    

    This will start the Golang server, and it will be accessible at http://localhost:8080.

  • Expose with Ngrok In a separate terminal, run Ngrok to expose your local server:

    ngrok http 8080
    

    Ngrok will generate public URLs (e.g., https://abcd1234.ngrok.io) that you can use to access your server from anywhere.

  • Access Images

    You can access your images by using the Ngrok-generated URL with the following structure:

    https://abcd1234.ngrok.io/images/your-image.jpg
    

Support Images Types

The server supports the following image types by default:

- JPEG (.jpg, .jpeg)
- PNG (.png)

You can add more image types by extending the getContentType function in the code.

Customization

You can customize the server code to fit your needs. For example, you can change the port, modify the supported image types, or enhance security.

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.