File tree 2 files changed +3
-3
lines changed
content/tutorial/02-sveltekit/05-api-routes/01-get-handlers 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ This app fetches data from a `/roll` API route when you click the button. Create
9
9
``` js
10
10
// / file: src/routes/roll/+server.js
11
11
export function GET () {
12
- const number = Math .ceil (Math .random () * 6 );
12
+ const number = Math .floor (Math .random () * 6 ) + 1 ;
13
13
14
14
return new Response (number, {
15
15
headers: {
@@ -28,7 +28,7 @@ Request handlers must return a [Response](https://developer.mozilla.org/en-US/do
28
28
++ + import { json } from ' @sveltejs/kit' ;++ +
29
29
30
30
export function GET () {
31
- const number = Math .ceil (Math .random () * 6 );
31
+ const number = Math .floor (Math .random () * 6 ) + 1 ;
32
32
33
33
-- - return new Response (number, {
34
34
headers: {
Original file line number Diff line number Diff line change 1
1
import { json } from '@sveltejs/kit' ;
2
2
3
3
export function GET ( ) {
4
- const number = Math . ceil ( Math . random ( ) * 6 ) ;
4
+ const number = Math . floor ( Math . random ( ) * 6 ) + 1 ;
5
5
6
6
return json ( number ) ;
7
7
}
You can’t perform that action at this time.
0 commit comments