From e7eabe6de028e7efe3307b042c35a93095ed84e8 Mon Sep 17 00:00:00 2001 From: William Boman Date: Wed, 19 Jun 2024 10:13:19 +0200 Subject: [PATCH] [WIP]: --- api/main.rs | 2 +- api/openvsx/[namespace]/[extension]/versions/all.rs | 10 ++-------- api/openvsx/[namespace]/[extension]/versions/latest.rs | 10 ++-------- vercel.json | 2 +- 4 files changed, 6 insertions(+), 18 deletions(-) diff --git a/api/main.rs b/api/main.rs index 3b1e90a..a9f1671 100644 --- a/api/main.rs +++ b/api/main.rs @@ -1,5 +1,5 @@ use mason_registry_api::setup_tracing; -use vercel_runtime::{run, bundled_api, Error}; +use vercel_runtime::{bundled_api, run, Body, Error, Request, Response}; #[tokio::main] async fn main() -> Result<(), Error> { diff --git a/api/openvsx/[namespace]/[extension]/versions/all.rs b/api/openvsx/[namespace]/[extension]/versions/all.rs index b0482f7..6b0dbf9 100644 --- a/api/openvsx/[namespace]/[extension]/versions/all.rs +++ b/api/openvsx/[namespace]/[extension]/versions/all.rs @@ -4,9 +4,9 @@ use mason_registry_api::{ vercel::parse_url, QueryParams, }; -use vercel_runtime::{run, Body, Error, Request, Response}; +use vercel_runtime::{Body, Error, Request, Response}; -async fn handler(request: Request) -> Result, Error> { +pub async fn handler(request: Request) -> Result, Error> { if request.method() != Method::GET { return Ok(Response::builder() .status(StatusCode::METHOD_NOT_ALLOWED) @@ -26,9 +26,3 @@ async fn handler(request: Request) -> Result, Error> { Err(err) => mason_registry_api::vercel::err_json(err), } } - -#[tokio::main] -async fn main() -> Result<(), Error> { - mason_registry_api::setup_tracing(); - run(handler).await -} diff --git a/api/openvsx/[namespace]/[extension]/versions/latest.rs b/api/openvsx/[namespace]/[extension]/versions/latest.rs index fd0d3f2..3b09410 100644 --- a/api/openvsx/[namespace]/[extension]/versions/latest.rs +++ b/api/openvsx/[namespace]/[extension]/versions/latest.rs @@ -4,9 +4,9 @@ use mason_registry_api::{ vercel::parse_url, QueryParams, }; -use vercel_runtime::{run, Body, Error, Request, Response}; +use vercel_runtime::{Body, Error, Request, Response}; -async fn handler(request: Request) -> Result, Error> { +pub async fn handler(request: Request) -> Result, Error> { if request.method() != Method::GET { return Ok(Response::builder() .status(StatusCode::METHOD_NOT_ALLOWED) @@ -26,9 +26,3 @@ async fn handler(request: Request) -> Result, Error> { Err(err) => mason_registry_api::vercel::err_json(err), } } - -#[tokio::main] -async fn main() -> Result<(), Error> { - mason_registry_api::setup_tracing(); - run(handler).await -} diff --git a/vercel.json b/vercel.json index 84a713a..68c3a16 100644 --- a/vercel.json +++ b/vercel.json @@ -2,7 +2,7 @@ "ignoreCommand": "[ \"$VERCEL_ENV\" != production ]", "functions": { "api/main.rs": { - "runtime": "vercel-rust@4.0.1" + "runtime": "vercel-rust@4.0.7" } }, "rewrites": [