Skip to content

rajput-hemant/jiosaavn-api-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

54 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

JioSaavn API

A wrapper for JioSaavn API written in Rust programming language πŸ¦€.

Note

This project is for educational purposes only. The author of this project is not responsible for any misuse of this API. Use it at your own risk.

πŸ”¨ Local Development

  • Rust should be installed on your system. If not, then install it from here.
git clone https://github.com/rajput-hemant/jiosaavn-api-rs
cd jiosaavn-api-rs
  • Run the following command to build the project.
cargo build --release
  • Run the following command to launch the api server.
cargo run --release

Vercel Dev Server

  • Vercel CLI should be installed on your system. If not, then install it from here.
vc dev

🌐 Deploying your own instance

Vercel (Recommended)

vc

OR

Deploy with Vercel

Note

To ensure that the API consistently respects the provided language, make sure to set the Function region within Vercel to Mumbai, India (South) - bom1.

Build and Run the Docker Image

Warning

You need to have Docker installed on your system. You might need to run the following commands with sudo depending on your system.

  • Start Docker daemon (Skip if already running)
sudo dockerd
  • Build the image
docker build -t jiosaavn .
  • Run the image
docker run -p 8080:8080 jiosaavn
  • Stop the container
docker ps
docker stop <container-id>

Deploy to Render

  • Login to your Render account and create a new Web Service.
  • Fill in the details, choose Runtime as Rust and click on Create Web Service.

cargo install cargo-shuttle
  • Make sure to change the main.rs file to the following:
// #[tokio::main]
#[shuttle_runtime::main]
// async fn main() {
async fn axum() -> shuttle_axum::ShuttleAxum {
    // tracing_subscriber::fmt::init();

    ...

    // let addr = "[::]:8080".parse().unwrap();

    // tracing::debug!("πŸš€ Server listening on {}", addr);
    // axum::Server::bind(&addr)
    //     .serve(app.into_make_service())
    //     .await
    //     .unwrap();

    Ok(router.into())
}
cargo shuttle project start
cargo shuttle deploy --allow-dirty

curl -L https://fly.io/install.sh | sh
  • A fly.toml file will be automatically generated by fly launch command which will ask a few questions to set everything up.
fly launch --name jiosaavn
  • Deploy the app
fly deploy

πŸ“œ License

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

🦾 Contributors: