Skip to content

feat(ext/http): simple andromeda serve#160

Merged
load1n9 merged 1 commit intotryandromeda:mainfrom
yossydev:feat/simple-andromeda-serve
Oct 6, 2025
Merged

feat(ext/http): simple andromeda serve#160
load1n9 merged 1 commit intotryandromeda:mainfrom
yossydev:feat/simple-andromeda-serve

Conversation

@yossydev
Copy link
Member

@yossydev yossydev commented Oct 6, 2025

✘ cargo run examples/serve/index.ts
    Updating crates.io index
   Compiling andromeda-core v0.1.0-draft48 (/Users/yossydev/Desktop/oss/andromeda/core)
   Compiling andromeda-runtime v0.1.0-draft48 (/Users/yossydev/Desktop/oss/andromeda/runtime)
   Compiling andromeda v0.1.0-draft48 (/Users/yossydev/Desktop/oss/andromeda/cli)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 16.25s
     Running `target/debug/andromeda examples/serve/index.ts`
🚀 Andromeda.serve Test Suite

HTTP server running on http://127.0.0.1:8080/
✅ Server running on http://127.0.0.1:8080/

📋 Test Commands:
  # Basic
  curl http://127.0.0.1:8080/
  curl http://127.0.0.1:8080/hello
  curl http://127.0.0.1:8080/user-agent

  # Headers
  curl http://127.0.0.1:8080/headers
  curl -v http://127.0.0.1:8080/cors

  # Query Parameters
  curl 'http://127.0.0.1:8080/search?q=hello&limit=5'

  # JSON Request
  curl -X POST http://127.0.0.1:8080/greet -d '{"name":"Alice"}'

  # Users API
  curl http://127.0.0.1:8080/users
  curl http://127.0.0.1:8080/users/1
  curl -X POST http://127.0.0.1:8080/users

  # Todos API
  curl http://127.0.0.1:8080/todos
  curl -X POST http://127.0.0.1:8080/todos -d '{"title":"Buy milk"}'
  curl -X PUT http://127.0.0.1:8080/todos/1 -d '{"completed":true}'
  curl -X DELETE http://127.0.0.1:8080/todos/1

  # Status
  curl http://127.0.0.1:8080/health
  curl http://127.0.0.1:8080/about

✘ curl 'http://127.0.0.1:8080/search?q=hello&limit=5'
{"query":"hello","limit":5,"results":["Result 1 for \"hello\"","Result 2 for \"hello\"","Result 3 for \"hello\""]}%            

@yossydev yossydev requested a review from load1n9 October 6, 2025 14:39
@yossydev yossydev self-assigned this Oct 6, 2025
@yossydev yossydev marked this pull request as ready for review October 6, 2025 14:39
Copy link
Member

@load1n9 load1n9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!!!!

@load1n9 load1n9 merged commit 23eef73 into tryandromeda:main Oct 6, 2025
7 checks passed
Comment on lines +25 to +31
// Global TCP stream storage for accepted connections
lazy_static::lazy_static! {
static ref GLOBAL_TCP_STREAMS: Arc<StdMutex<HashMap<u32, Arc<Mutex<TcpStream>>>>> =
Arc::new(StdMutex::new(HashMap::new()));
static ref NEXT_STREAM_ID: Arc<StdMutex<u32>> = Arc::new(StdMutex::new(1));
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No please, no lazy statics with Arcs and mutexes, use the store api of extensions like we use in the rest, e.g fs

storage: Some(Box::new(|storage: &mut OpsStorage| {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants