Home >Web Front-end >JS Tutorial >Github Image Hosting API with UI

Github Image Hosting API with UI

DDD
DDDOriginal
2024-12-04 10:16:13969browse

Github Image Hosting API with UI

This project is a proof of concept for using a GitHub repository as an image hosting service. The API allows users to upload, list, and delete image files from the repository, providing an easy interface to manage files hosted on GitHub.

Github : MasFana/Github-Image-Bucket-API


Installation

To set up and run this project, you need Node.js and npm installed on your system.

  1. Clone the repository:

    git clone https://github.com/MasFana/Github-Image-Bucket-API
    cd Github-Image-Bucket-API
    
    
  2. Install dependencies:

    npm install
    
    
  3. Set up environment variables by creating a .env file in the root directory with the following values:

    GITHUB_TOKEN=<your_github_token>
    GITHUB_REPO=<your_github_repo>
    GITHUB_BRANCH=<your_github_branch>
    
    
  4. Start the server:

    npm start
    
    

The server will run on http://localhost:3000.


Environment Variables

The API requires the following environment variables to be set:

  • GITHUB_TOKEN: GitHub Personal Access Token for authentication.
  • GITHUB_REPO: GitHub repository name in the format owner/repository.
  • GITHUB_BRANCH: GitHub branch name where files will be uploaded.

The above is the detailed content of Github Image Hosting API with UI. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn