Skip to content

Commit 97c007b

Browse files
chore: wip
1 parent 31db33f commit 97c007b

File tree

3 files changed

+28
-20
lines changed

3 files changed

+28
-20
lines changed

routes/api.ts

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@ import { route } from '@stacksjs/router'
88
* @see https://docs.stacksjs.org/routing
99
*/
1010

11-
route.get('/foo/bar/{id}', () => 'hello world, foo bar') // $API_URL/hello/world
12-
route.get('/', () => 'hello world') // $API_URL
13-
route.get('/hello/world', () => 'hello world, buddy') // $API_URL/hello/world
14-
15-
route.post('/email/subscribe', 'Actions/SubscriberEmailAction')
16-
route.post('/login', 'Actions/LoginAction')
17-
route.get('/generate-registration-options', 'Actions/Auth/GenerateRegistrationAction')
18-
route.post('/verify-registration', 'Actions/Auth/VerifyRegistrationAction')
19-
route.get('/generate-authentication-options', 'Actions/Auth/GenerateAuthenticationAction')
20-
route.post('/verify-authentication', 'Actions/Auth/VerifyAuthenticationAction')
21-
22-
// route.email('/welcome')
23-
route.health() // adds a GET `/health` route
24-
route.get('/install', 'Actions/InstallAction')
25-
route.post('/ai/ask', 'Actions/AI/AskAction')
26-
route.post('/ai/summary', 'Actions/AI/SummaryAction')
11+
// route.get('/foo/bar/{id}', () => 'hello world, foo bar') // $API_URL/hello/world
12+
// route.get('/', () => 'hello world') // $API_URL
13+
// route.get('/hello/world', () => 'hello world, buddy') // $API_URL/hello/world
14+
15+
// route.post('/email/subscribe', 'Actions/SubscriberEmailAction')
16+
// route.post('/login', 'Actions/LoginAction')
17+
// route.get('/generate-registration-options', 'Actions/Auth/GenerateRegistrationAction')
18+
// route.post('/verify-registration', 'Actions/Auth/VerifyRegistrationAction')
19+
// route.get('/generate-authentication-options', 'Actions/Auth/GenerateAuthenticationAction')
20+
// route.post('/verify-authentication', 'Actions/Auth/VerifyAuthenticationAction')
21+
22+
// // route.email('/welcome')
23+
// route.health() // adds a GET `/health` route
24+
// route.get('/install', 'Actions/InstallAction')
25+
// route.post('/ai/ask', 'Actions/AI/AskAction')
26+
// route.post('/ai/summary', 'Actions/AI/SummaryAction')
2727

2828
route.group({ prefix: '/payments' }, async () => {
2929
route.get('/fetch-customer/{id}', 'Actions/Payment/FetchPaymentCustomerAction')
@@ -51,6 +51,10 @@ route.group({ prefix: '/payments' }, async () => {
5151
route.post('/store-transaction/{id}', 'Actions/Payment/StoreTransactionAction')
5252
})
5353

54+
route.group({ prefix: '/queues' }, async () => {
55+
route.get('/', 'Actions/Queue/FetchQueuesAction')
56+
})
57+
5458
// route.action('/example') // equivalent to `route.get('/example', 'ExampleAction')`
5559
// route.action('Dashboard/GetProjects')
5660
// route.action('Dashboard/Settings/UpdateAiConfig')

storage/framework/api/dev.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ async function watchFolders() {
4545
cwd: path.corePath(dir.name),
4646
})
4747
})
48-
}
48+
}
4949
})
5050

5151
watch(path.routesPath(), (event: string, filename: string | null) => {

storage/framework/core/router/src/router.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export class Router implements RouterInterface {
5858
log.debug(`Normalized Path: ${this.path}`)
5959

6060
const uri = this.prepareUri(this.path)
61+
6162
log.debug(`Prepared URI: ${uri}`)
6263

6364
return this.addRoute('GET', uri, callback, 200)
@@ -196,10 +197,13 @@ export class Router implements RouterInterface {
196197

197198
// Add the prefix to the route path
198199

200+
const prefix = options.prefix || '/'
201+
const formattedPrefix = prefix.startsWith("/") ? prefix : `/${prefix}`;
202+
console.log(r.uri)
199203
if (options.prefix) {
200-
r.path = `${options.prefix}/${r.uri}`
201-
r.uri = `${options.prefix}/${r.uri}`
202-
r.url = `${options.prefix}/${r.uri}`
204+
r.path = formattedPrefix + r.uri
205+
r.uri = formattedPrefix + r.uri
206+
r.url = r.uri
203207
}
204208

205209
// Push the modified route to the original routes array

0 commit comments

Comments
 (0)