Skip to content

Commit 96f630f

Browse files
committed
fix lint
1 parent cc3458f commit 96f630f

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

documentation/en/Cloudflare-Workers.md

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,12 @@ Develop your code in the `src/index.ts`. Here are some examples:
5454
1. local mysql example
5555
5656
```ts
57+
5758
import { createConnection } from 'mysql2';
5859
60+
async function sleep(ms) {
61+
return new Promise(resolve => setTimeout(resolve, ms));
62+
}
5963
export default {
6064
async fetch(
6165
request: Request,
@@ -84,17 +88,16 @@ Develop your code in the `src/index.ts`. Here are some examples:
8488
return new Response(JSON.stringify(result))
8589
},
8690
};
87-
88-
async function sleep(ms) {
89-
return new Promise(resolve => setTimeout(resolve, ms));
90-
}
9191
```
9292

9393
2. TiDB Serverless example with TLS:
9494

95-
```js
95+
```ts
9696
import { createConnection } from 'mysql2';
9797

98+
async function sleep(ms) {
99+
return new Promise(resolve => setTimeout(resolve, ms));
100+
}
98101
export default {
99102
async fetch(
100103
request: Request,
@@ -128,17 +131,17 @@ Develop your code in the `src/index.ts`. Here are some examples:
128131
return new Response(JSON.stringify(result))
129132
},
130133
};
131-
132-
async function sleep(ms) {
133-
return new Promise(resolve => setTimeout(resolve, ms));
134-
}
135134
```
136135

137136
3. PlanetScale example with TLS:
138137

139-
```js
138+
```ts
140139
import { createConnection } from 'mysql2';
141140

141+
async function sleep(ms) {
142+
return new Promise(resolve => setTimeout(resolve, ms));
143+
}
144+
142145
export default {
143146
async fetch(
144147
request: Request,
@@ -172,10 +175,6 @@ Develop your code in the `src/index.ts`. Here are some examples:
172175
return new Response(JSON.stringify(result))
173176
},
174177
};
175-
176-
async function sleep(ms) {
177-
return new Promise(resolve => setTimeout(resolve, ms));
178-
}
179178
```
180179

181180
## Step 4: Test locally
@@ -231,8 +230,11 @@ If you want to develop the corresponding feature. Here is a simaple example of t
231230

232231
4. write your test code inside worker.js
233232

234-
```
233+
```js
235234
const { createConnection } = require('../index');
235+
async function sleep(ms) {
236+
return new Promise(resolve => setTimeout(resolve, ms));
237+
}
236238
export default {
237239
async fetch(request, env, ctx) {
238240
let result
@@ -257,10 +259,6 @@ If you want to develop the corresponding feature. Here is a simaple example of t
257259
return new Response(JSON.stringify(result))
258260
}
259261
};
260-
261-
async function sleep(ms) {
262-
return new Promise(resolve => setTimeout(resolve, ms));
263-
}
264262
```
265263

266264
5. Test locally

0 commit comments

Comments
 (0)