vercel-community / rust

🦀 Rust runtime for ▲ Vercel Serverless Functions
https://rust-runtime.vercel.app
MIT License
816 stars 50 forks source link

How would I use this with other Rust web crate? #119

Closed ManicMarrc closed 10 months ago

ManicMarrc commented 10 months ago

How would I use this with another web crate like Actix or Rocket?

ecklf commented 10 months ago

This runtime builds on top of tower so you'd need to use the exposed ServiceBuilder to hook in your framework. This repo would be an example for axum

Once you have that implementation you also need to add rewrites to your vercel.json

{
  "rewrites": [{ "source": "/api/(.*)", "destination": "/api/handler" }]
}
abhemanyus commented 7 months ago

@ecklf Is this still valid?

abhemanyus commented 7 months ago

Figured it out https://github.com/abhemanyus/vercel-axum-router Don't know how I feel about the modifications I had to do to lib.rs, though. You'd do me a solid by taking a look at it.