BREAKING_CHANGE(routing): refactor route configuration to support multiple targets
Some checks failed
Default (tags) / security (push) Successful in 53s
Default (tags) / test (push) Failing after 31m2s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped

This commit is contained in:
Juergen Kunz
2025-07-21 08:45:13 +00:00
parent 6aa5f415c1
commit aa6ddbc4a6
51 changed files with 2916 additions and 158 deletions

View File

@@ -95,10 +95,10 @@ tap.test('should support static host/port routes', async () => {
},
action: {
type: 'forward',
target: {
targets: [{
host: 'localhost',
port: serverPort
}
}]
}
}
];
@@ -135,13 +135,13 @@ tap.test('should support function-based host', async () => {
},
action: {
type: 'forward',
target: {
targets: [{
host: (context: IRouteContext) => {
// Return localhost always in this test
return 'localhost';
},
port: serverPort
}
}]
}
}
];
@@ -178,13 +178,13 @@ tap.test('should support function-based port', async () => {
},
action: {
type: 'forward',
target: {
targets: [{
host: 'localhost',
port: (context: IRouteContext) => {
// Return test server port
return serverPort;
}
}
}]
}
}
];
@@ -221,14 +221,14 @@ tap.test('should support function-based host AND port', async () => {
},
action: {
type: 'forward',
target: {
targets: [{
host: (context: IRouteContext) => {
return 'localhost';
},
port: (context: IRouteContext) => {
return serverPort;
}
}
}]
}
}
];
@@ -265,7 +265,7 @@ tap.test('should support context-based routing with path', async () => {
},
action: {
type: 'forward',
target: {
targets: [{
host: (context: IRouteContext) => {
// Use path to determine host
if (context.path?.startsWith('/api')) {
@@ -275,7 +275,7 @@ tap.test('should support context-based routing with path', async () => {
}
},
port: serverPort
}
}]
}
}
];