diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..139c537 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,45 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "lldb", + "request": "launch", + "name": "Debug executable 'lupinIII'", + "cargo": { + "args": [ + "build", + "--bin=lupinIII", + "--package=lupinIII" + ], + "filter": { + "name": "lupinIII", + "kind": "bin" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug unit tests in executable 'lupinIII'", + "cargo": { + "args": [ + "test", + "--no-run", + "--bin=lupinIII", + "--package=lupinIII" + ], + "filter": { + "name": "lupinIII", + "kind": "bin" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + } + ] +} \ No newline at end of file diff --git a/README.md b/README.md index 004afa2..eeafc2e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ # lupin -inference engine on GPUs + +Inference API aggregator for performance requirements. diff --git a/src/main.rs b/src/main.rs index 371dfbe..bd08216 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,19 +1,31 @@ -use axum::{response::Html, routing::get, Router}; +// coding=utf-8 + +// Copyright [2024] [SkywardAI] +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 + +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +pub mod routing; + +use routing::routers::create_router; + #[tokio::main] async fn main() { - // single router - let app = Router::new().route("/", get(handler)); - let listener = tokio::net::TcpListener::bind("127.0.0.1:8000") - .await - .unwrap(); + let app = create_router(); + + let listener = tokio::net::TcpListener::bind("0.0.0.0:8000").await.unwrap(); println!("Listening on: {}", listener.local_addr().unwrap()); axum::serve(listener, app).await.unwrap(); } - -async fn handler() -> Html<&'static str> { - Html("

Hello, World!

") -} diff --git a/src/routing/mod.rs b/src/routing/mod.rs new file mode 100644 index 0000000..45adcb7 --- /dev/null +++ b/src/routing/mod.rs @@ -0,0 +1 @@ +pub mod routers; \ No newline at end of file diff --git a/src/routing/routers.rs b/src/routing/routers.rs new file mode 100644 index 0000000..f02f9fa --- /dev/null +++ b/src/routing/routers.rs @@ -0,0 +1,19 @@ +// routers.rs +use axum::{response::Html, routing::get, Router}; + +pub fn create_router() -> Router { + let inference = Router::new() + .route("/", get(inference)); + + Router::new() + .route("/", get(handler)) + .nest("/inference", inference) +} + +async fn handler() -> Html<&'static str> { + Html("

Welcome!

") +} + +async fn inference() -> Html<&'static str> { + Html("

Inference!

") +} \ No newline at end of file