Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
shiyuhang0 committed Dec 26, 2023
1 parent cc3458f commit 96f630f
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions documentation/en/Cloudflare-Workers.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,12 @@ Develop your code in the `src/index.ts`. Here are some examples:
1. local mysql example
```ts
import { createConnection } from 'mysql2';
async function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
export default {
async fetch(
request: Request,
Expand Down Expand Up @@ -84,17 +88,16 @@ Develop your code in the `src/index.ts`. Here are some examples:
return new Response(JSON.stringify(result))
},
};
async function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
```

2. TiDB Serverless example with TLS:

```js
```ts
import { createConnection } from 'mysql2';

async function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
export default {
async fetch(
request: Request,
Expand Down Expand Up @@ -128,17 +131,17 @@ Develop your code in the `src/index.ts`. Here are some examples:
return new Response(JSON.stringify(result))
},
};

async function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
```

3. PlanetScale example with TLS:

```js
```ts
import { createConnection } from 'mysql2';

async function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}

export default {
async fetch(
request: Request,
Expand Down Expand Up @@ -172,10 +175,6 @@ Develop your code in the `src/index.ts`. Here are some examples:
return new Response(JSON.stringify(result))
},
};

async function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
```

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

4. write your test code inside worker.js

```
```js
const { createConnection } = require('../index');
async function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
export default {
async fetch(request, env, ctx) {
let result
Expand All @@ -257,10 +259,6 @@ If you want to develop the corresponding feature. Here is a simaple example of t
return new Response(JSON.stringify(result))
}
};
async function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
```

5. Test locally
Expand Down

0 comments on commit 96f630f

Please sign in to comment.