Binbiubiubiu / turntable

an implementation of the unpkg backend interface for the Rust version

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

🎑 Turntable

Turntable is an implementation of the unpkg backend interface for the Rust version. It is based on Poem and Tokio.

πŸš€ Getting Started

Prerequisites

  • Rust 1.65 or higher
  • Cargo

Installation

  1. Clone the repository:

    git clone https://github.com/Binbiubiubiu/turntable.git
    
  2. Build the project:

    cargo build
    
  3. Run the project:

    cargo run
    

πŸ“ Usage

Turntable provides an API that allows you to access the unpkg backend interface. You can use it to fetch and serve JavaScript packages.

Endpoints

  • / - Returns the homepage.
  • /package/:name@:version/:file - Returns a specific file from a package.
  • /package/:name@:version/:file?meta - Returns metadata about a specific file from a package.

Examples

  • Fetch a specific file from a package:

    curl http://localhost:8000/package/lodash@4.17.21/lodash.js
    
  • Fetch metadata about a specific file from a package:

    curl http://localhost:8000/package/lodash@4.17.21/lodash.js?meta
    

🀝 Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request.

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

About

an implementation of the unpkg backend interface for the Rust version

License:MIT License


Languages

Language:Rust 98.5%Language:Dockerfile 0.7%Language:Just 0.7%Language:JavaScript 0.1%