|
1 | 1 | import type { RedirectCode, Route, RouteGroupOptions, StatusCode } from '@stacksjs/types'
|
2 |
| -import { path as p, projectPath } from '@stacksjs/path' |
| 2 | +import { path as p, routesPath } from '@stacksjs/path' |
3 | 3 | import { pascalCase } from '@stacksjs/strings'
|
4 | 4 |
|
5 | 5 | type Prefix = string
|
@@ -57,6 +57,7 @@ export class Router implements RouterInterface {
|
57 | 57 | public async get(path: Route['url'], callback: Route['callback']): Promise<this> {
|
58 | 58 | this.path = this.normalizePath(path)
|
59 | 59 | callback = await this.resolveCallback(callback)
|
| 60 | + // eslint-disable-next-line no-console |
60 | 61 | console.log('this.path', this.path, callback)
|
61 | 62 |
|
62 | 63 | return this.addRoute('GET', this.prepareUri(this.path), callback, 200)
|
@@ -197,15 +198,7 @@ export class Router implements RouterInterface {
|
197 | 198 | }
|
198 | 199 |
|
199 | 200 | public async getRoutes(): Promise<Route[]> {
|
200 |
| - // const routeFileData = (await readTextFile(projectPath('routes/web.ts'))).data |
201 |
| - |
202 |
| - await import(projectPath('routes/api.ts')) |
203 |
| - |
204 |
| - // run routes/web.ts |
205 |
| - // const webRoutesPath = projectPath('routes/web.ts') |
206 |
| - // await runCommand(`bun ${webRoutesPath}`) |
207 |
| - |
208 |
| - // set this.routes to a mapped array of routes that matches the pattern |
| 201 | + await import(routesPath('api.ts')) |
209 | 202 |
|
210 | 203 | return this.routes
|
211 | 204 | }
|
|
0 commit comments