Skip to content

Commit 527e1c2

Browse files
committed
chore: wip
chore: wip
1 parent d7feff2 commit 527e1c2

File tree

6 files changed

+18
-11
lines changed

6 files changed

+18
-11
lines changed

bun.lockb

-122 KB
Binary file not shown.

routes/api.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@ await route.get('/', () => 'hello world') // $APP_URL/api
1212
await route.get('/hello/world', () => 'hello world, buddy') // stacksjs.org/api/hello/world
1313
await route.get('/buddy/versions', 'Actions/Buddy/VersionsAction') // stacksjs.org/api/buddy/versions
1414
await route.get('/buddy/commands', 'Actions/Buddy/CommandsAction') // stacksjs.org/api/buddy/commands
15-
await route.get('/welcome', () => { // $APP_URL/api/welcome
15+
await route.get('/hello-world', () => { // $APP_URL/api/welcome
1616
return { // you may return an object as well
1717
data: 'hello world, friend',
1818
}
1919
})
2020

21+
await route.email('/welcome')
2122
await route.health() // adds an `/api/health` route
2223

2324
// await route.group('/buddy', async () => { // you may group your routes in a few different ways

storage/framework/cloud/package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,9 @@
101101
"constructs": "^10.3.0"
102102
},
103103
"devDependencies": {
104-
"@oclif/plugin-plugins": "^4.2.3",
105104
"@stacksjs/cli": "workspace:*",
106105
"@stacksjs/development": "workspace:*",
107106
"@stacksjs/env": "workspace:*",
108-
"jszip": "^3.10.1",
109-
"oclif": "^4.4.12",
110107
"source-map-support": "^0.5.21"
111108
}
112109
}

storage/framework/core/cloud/package.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@
4848
"deploy": "cd ../.. && bun run build && cd ../docs && bun run build && cd ../core/cloud && bunx cdk deploy --require-approval never",
4949
"build": "bun build.ts",
5050
"build-edge": "bun build ./src/edge/origin-request.ts --outfile ./dist/origin-request.js",
51-
"build-layer": "bun ./src/runtime/scripts/build-layer.ts",
52-
"publish-layer": "bun ./src/runtime/scripts/publish-layer.ts",
53-
"build-server": "echo 'bun --bun build-server.ts'",
5451
"typecheck": "bun --bun tsc --noEmit",
5552
"prepublishOnly": "bun run build"
5653
},
@@ -108,12 +105,9 @@
108105
"constructs": "^10.3.0"
109106
},
110107
"devDependencies": {
111-
"@oclif/plugin-plugins": "^4.2.3",
112108
"@stacksjs/cli": "workspace:*",
113109
"@stacksjs/development": "workspace:*",
114110
"@stacksjs/env": "workspace:*",
115-
"jszip": "^3.10.1",
116-
"oclif": "^4.4.12",
117111
"source-map-support": "^0.5.21"
118112
}
119113
}

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ export interface RouterInterface {
1313
delete: (url: Route['url'], callback: Route['callback']) => this
1414
patch: (url: Route['url'], callback: Route['callback']) => this
1515
put: (url: Route['url'], callback: Route['callback']) => this
16+
email: (url: Route['url']) => Promise<this>
17+
health: () => Promise<this>
18+
job: (url: Route['url']) => Promise<this>
19+
action: (url: Route['url']) => Promise<this>
1620
group: (options: Prefix | RouteGroupOptions, callback: () => void) => this
1721
name: (name: string) => this
1822
middleware: (middleware: Route['middleware']) => this
@@ -69,6 +73,17 @@ export class Router implements RouterInterface {
6973
return this.addRoute('GET', uri, callback, 200)
7074
}
7175

76+
public async email(path: Route['url']): Promise<this> {
77+
// wip
78+
const emailModule = await import(p.userActionsPath('EmailAction.ts'))
79+
const callback = emailModule.default.handle
80+
81+
const uri = this.prepareUri(path)
82+
this.addRoute('GET', uri, callback, 200)
83+
84+
return this
85+
}
86+
7287
public async health(): Promise<this> {
7388
const healthModule = await import(p.userActionsPath('HealthAction.ts'))
7489
const callback = healthModule.default.handle

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export type RouteCallback = (params?: Record<string, any>) => any | string | obj
4040
export interface Route {
4141
name: string
4242
uri: string
43-
url: `/${string}` // used synonymously with uri
43+
url: string // used synonymously with uri
4444
method: HttpMethod
4545
pattern: RegExp
4646
callback: RouteCallback | ActionPath | Action | Promise<any> // we may be able to improve the `Promise<any>` if we could narrow this type `import('../app/Actions/BuddyAction')`

0 commit comments

Comments
 (0)