This repository was archived by the owner on Jul 6, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 8 files changed +36
-36
lines changed
hello-world-css-modules/api/counter
hello-world-spa/api/counter
hello-world-src-dir/src/api/counter Expand file tree Collapse file tree 8 files changed +36
-36
lines changed Original file line number Diff line number Diff line change 1
- import type { APIRequest } from 'aleph/types.ts'
1
+ import type { APIHandler } from 'aleph/types.ts'
2
2
3
- export default async function handler ( { router, response : resp } : APIRequest ) {
3
+ export const handler : APIHandler = ( { router, response } ) => {
4
4
let count = parseInt ( localStorage . getItem ( 'count' ) || '0' )
5
5
6
6
switch ( router . params [ 'action' ] ) {
7
7
case 'increase' :
8
8
count ++
9
9
localStorage . setItem ( 'count' , count . toString ( ) )
10
- resp . json ( { count } )
10
+ response . json ( { count } )
11
11
break
12
12
case 'decrease' :
13
13
count --
14
14
localStorage . setItem ( 'count' , count . toString ( ) )
15
- resp . json ( { count } )
15
+ response . json ( { count } )
16
16
break
17
17
default :
18
- resp . status = 400
19
- resp . json ( {
18
+ response . status = 400
19
+ response . json ( {
20
20
error : 'UnknownAction' ,
21
21
status : 400 ,
22
22
message : `undefined action '${ router . params [ 'action' ] } '`
Original file line number Diff line number Diff line change 1
- import type { APIRequest } from 'aleph/types.ts'
1
+ import type { APIHandler } from 'aleph/types.ts'
2
2
3
- export default async function handler ( { response : resp } : APIRequest ) {
3
+ export const handler : APIHandler = ( { response } ) => {
4
4
const count = parseInt ( localStorage . getItem ( 'count' ) || '0' )
5
- resp . json ( { count } )
5
+ response . json ( { count } )
6
6
}
Original file line number Diff line number Diff line change 1
- import type { APIRequest } from 'aleph/types.ts'
1
+ import type { APIHandler } from 'aleph/types.ts'
2
2
3
- export default async function handler ( { router, response : resp } : APIRequest ) {
3
+ export const handler : APIHandler = ( { router, response } ) => {
4
4
let count = parseInt ( localStorage . getItem ( 'count' ) || '0' )
5
5
6
6
switch ( router . params [ 'action' ] ) {
7
7
case 'increase' :
8
8
count ++
9
9
localStorage . setItem ( 'count' , count . toString ( ) )
10
- resp . json ( { count } )
10
+ response . json ( { count } )
11
11
break
12
12
case 'decrease' :
13
13
count --
14
14
localStorage . setItem ( 'count' , count . toString ( ) )
15
- resp . json ( { count } )
15
+ response . json ( { count } )
16
16
break
17
17
default :
18
- resp . status = 400
19
- resp . json ( {
18
+ response . status = 400
19
+ response . json ( {
20
20
error : 'UnknownAction' ,
21
21
status : 400 ,
22
22
message : `undefined action '${ router . params [ 'action' ] } '`
Original file line number Diff line number Diff line change 1
- import type { APIRequest } from 'aleph/types.ts'
1
+ import type { APIHandler } from 'aleph/types.ts'
2
2
3
- export default async function handler ( { response : resp } : APIRequest ) {
3
+ export const handler : APIHandler = ( { response } ) => {
4
4
const count = parseInt ( localStorage . getItem ( 'count' ) || '0' )
5
- resp . json ( { count } )
5
+ response . json ( { count } )
6
6
}
Original file line number Diff line number Diff line change 1
- import type { APIRequest } from 'aleph/types.ts'
1
+ import type { APIHandler } from 'aleph/types.ts'
2
2
3
- export default async function handler ( { router, response : resp } : APIRequest ) {
3
+ export const handler : APIHandler = ( { router, response } ) => {
4
4
let count = parseInt ( localStorage . getItem ( 'count' ) || '0' )
5
5
6
6
switch ( router . params [ 'action' ] ) {
7
7
case 'increase' :
8
8
count ++
9
9
localStorage . setItem ( 'count' , count . toString ( ) )
10
- resp . json ( { count } )
10
+ response . json ( { count } )
11
11
break
12
12
case 'decrease' :
13
13
count --
14
14
localStorage . setItem ( 'count' , count . toString ( ) )
15
- resp . json ( { count } )
15
+ response . json ( { count } )
16
16
break
17
17
default :
18
- resp . status = 400
19
- resp . json ( {
18
+ response . status = 400
19
+ response . json ( {
20
20
error : 'UnknownAction' ,
21
21
status : 400 ,
22
22
message : `undefined action '${ router . params [ 'action' ] } '`
Original file line number Diff line number Diff line change 1
- import type { APIRequest } from 'aleph/types.ts'
1
+ import type { APIHandler } from 'aleph/types.ts'
2
2
3
- export default async function handler ( { response : resp } : APIRequest ) {
3
+ export const handler : APIHandler = ( { response } ) => {
4
4
const count = parseInt ( localStorage . getItem ( 'count' ) || '0' )
5
- resp . json ( { count } )
5
+ response . json ( { count } )
6
6
}
Original file line number Diff line number Diff line change 1
- import type { APIRequest } from 'aleph/types.ts'
1
+ import type { APIHandler } from 'aleph/types.ts'
2
2
3
- export default async function handler ( { router, response : resp } : APIRequest ) {
3
+ export const handler : APIHandler = ( { router, response } ) => {
4
4
let count = parseInt ( localStorage . getItem ( 'count' ) || '0' )
5
5
6
6
switch ( router . params [ 'action' ] ) {
7
7
case 'increase' :
8
8
count ++
9
9
localStorage . setItem ( 'count' , count . toString ( ) )
10
- resp . json ( { count } )
10
+ response . json ( { count } )
11
11
break
12
12
case 'decrease' :
13
13
count --
14
14
localStorage . setItem ( 'count' , count . toString ( ) )
15
- resp . json ( { count } )
15
+ response . json ( { count } )
16
16
break
17
17
default :
18
- resp . status = 400
19
- resp . json ( {
18
+ response . status = 400
19
+ response . json ( {
20
20
error : 'UnknownAction' ,
21
21
status : 400 ,
22
22
message : `undefined action '${ router . params [ 'action' ] } '`
Original file line number Diff line number Diff line change 1
- import type { APIRequest } from 'aleph/types.ts'
1
+ import type { APIHandler } from 'aleph/types.ts'
2
2
3
- export default async function handler ( { response : resp } : APIRequest ) {
3
+ export const handler : APIHandler = ( { response } ) => {
4
4
const count = parseInt ( localStorage . getItem ( 'count' ) || '0' )
5
- resp . json ( { count } )
5
+ response . json ( { count } )
6
6
}
You can’t perform that action at this time.
0 commit comments