Skip to content

Commit 146d2ab

Browse files
authored
Merge pull request #626 from p0tat0chip/docs
Add Instructions to run generated code in JS(axios, fetch) and Go
2 parents 5245052 + 2cd1094 commit 146d2ab

File tree

1 file changed

+88
-3
lines changed

1 file changed

+88
-3
lines changed

doc/user_guide/instructions_to_run_generated_code.md

+88-3
Original file line numberDiff line numberDiff line change
@@ -268,15 +268,100 @@ Here are the detailed instructions for running the generated API Dash code in **
268268

269269
## Go (net/http)
270270

271-
TODO
271+
### 1. Install Go compiler
272+
273+
- Windows and MacOS: check out the [official source](https://go.dev/doc/install)
274+
- Linux: Install from your distro's package manager.
275+
276+
Verify if go is installed:
277+
278+
```bash
279+
go version
280+
```
281+
282+
### 2. Create a project
283+
```bash
284+
go mod init example.com/api
285+
```
286+
287+
### 3. Run the generated code
288+
- Paste the generated code into `main.go`.
289+
- Build and run by `go run main.go`.
272290
273291
## JavaScript (axios)
274292
275-
TODO
293+
The generated api code can be run in browser by using the code in an html file as demonstrated below:
294+
295+
### 1. Create the html file with generated code
296+
297+
Create a new file `index.html`
298+
299+
```html
300+
<!DOCTYPE html>
301+
<html>
302+
<head>
303+
<title>Axios Example</title>
304+
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
305+
</head>
306+
<body>
307+
<script>
308+
// Paste your API Dash generated code here !!
309+
</script>
310+
</body>
311+
</html>
312+
313+
```
314+
315+
Make sure to paste the generated js code from api dash under the `<script>` tag.
316+
317+
### 2. Test with Browser Developer Tools
318+
319+
Open the `index.html` file in a modern browser and open devtools.
320+
321+
- **Chrome**: Right-click the page and select "Inspect" or press Ctrl+Shift+I (Windows/Linux) or Cmd+Option+I (macOS).
322+
323+
- **Firefox**: Right-click the page and select "Inspect Element" or press Ctrl+Shift+I (Windows/Linux) or Cmd+Option+I (macOS).
324+
325+
- **Edge**: Right-click the page and select "Inspect" or press F12 or Ctrl+Shift+I.
326+
327+
Navigate to network tab and refresh the page to see the requests and network activity.
276328
277329
## JavaScript (fetch)
278330
279-
TODO
331+
The generated api code can be run in browser by using the code in an html file as demonstrated below:
332+
333+
### 1. Create the html file with generated code
334+
335+
Create a new file `index.html`
336+
337+
```html
338+
<!DOCTYPE html>
339+
<html>
340+
<head>
341+
<title>Fetch Example</title>
342+
</head>
343+
<body>
344+
<script>
345+
// Paste your API Dash generated code here !!
346+
</script>
347+
</body>
348+
</html>
349+
350+
```
351+
352+
Make sure to paste the generated js code from api dash under the `<script>` tag.
353+
354+
### 2. Test with Browser Developer Tools
355+
356+
Open the `index.html` file in a modern browser and open devtools.
357+
358+
- **Chrome**: Right-click the page and select "Inspect" or press Ctrl+Shift+I (Windows/Linux) or Cmd+Option+I (macOS).
359+
360+
- **Firefox**: Right-click the page and select "Inspect Element" or press Ctrl+Shift+I (Windows/Linux) or Cmd+Option+I (macOS).
361+
362+
- **Edge**: Right-click the page and select "Inspect" or press F12 or Ctrl+Shift+I.
363+
364+
Navigate to network tab and refresh the page to see the requests and network activity.
280365
281366
## node.js (JavaScript, axios)
282367

0 commit comments

Comments
 (0)