refactor: Update new_server signature and module structure
- Adjust `new_server` calls to use `ServerConfig` struct - Unify `AuthConfig` and manager type references within module - Remove duplicate `ServerConfig` and factory function definition - Update `test_heroserver_new` to reflect API changes - Refine internal module imports and factory calls
This commit is contained in:
@@ -2,5 +2,8 @@
|
||||
|
||||
import freeflowuniverse.herolib.hero.heroserver
|
||||
|
||||
mut server := heroserver.new_server(port: 8080)!
|
||||
mut server := heroserver.new_server(heroserver.ServerConfig{
|
||||
port: 8080
|
||||
auth_config: heroserver.AuthConfig{}
|
||||
})!
|
||||
server.start()!
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import freeflowuniverse.herolib.hero.heroserver
|
||||
import freeflowuniverse.herolib.schemas.openrpc
|
||||
|
||||
fn testsuite_begin() {
|
||||
// a clean start
|
||||
@@ -8,16 +7,12 @@ fn testsuite_begin() {
|
||||
|
||||
fn test_heroserver_new() {
|
||||
// Create server
|
||||
mut server := heroserver.new_server(port: 8080)!
|
||||
|
||||
// Register handlers
|
||||
spec := openrpc.from_file('./openrpc.json')!
|
||||
handler := openrpc.new_handler(spec)
|
||||
|
||||
server.handler_registry.register('comments', handler, spec)
|
||||
|
||||
// Start server
|
||||
go server.start()
|
||||
mut server := heroserver.new_server(heroserver.ServerConfig{
|
||||
port: 8080
|
||||
auth_config: heroserver.AuthConfig{}
|
||||
})!
|
||||
|
||||
// Test that server was created successfully
|
||||
assert server.config.port == 8080
|
||||
assert true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user