Skip to content

ft: instructions for running go code from apidash #625

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added doc/user_guide/img_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
67 changes: 62 additions & 5 deletions doc/user_guide/instructions_to_run_generated_code.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ Choose your programming language/library from the list provided below to learn m
- [Dart (http)](#dart-http)
- [Dart (dio)](#dart-dio)
- [Go (net/http)](#go-nethttp)
- [JavaScript (axios)](#javascript-axios)
- [JavaScript (fetch)](#javascript-fetch)
- [JavaScript (axios)](#javascript-axios)
- [node.js (JavaScript, axios)](#nodejs-javascript-axios)
- [node.js (JavaScript, fetch)](#nodejs-javascript-fetch)
- [Java (asynchttpclient)](#java-asynchttpclient)
Expand Down Expand Up @@ -268,15 +268,72 @@ Here are the detailed instructions for running the generated API Dash code in **

## Go (net/http)

TODO
### Prerequisites

## JavaScript (axios)
#### Install Go

TODO
- Windows and MacOS:
Download and install go from [official website](https://go.dev/doc/install).
- Linux: Install from your package manager or follow the [official source](https://go.dev/doc/install)

#### Verify Installtion
```bash
go version
```

### Create a golang project

```bash
go mod init example.com/api-example
```

### Run the code

Create a new file named `main.go` and paste the generated code from `apidash`.
run the program with:

```bash
go run main.go
```

## JavaScript (fetch)

TODO
#### 1. Create a new HTML file `index.html`. Paste your generated code inside the `<script>` tags

```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Fetch API Example</title>
</head>
<body>
<script>
Copy and paste your generated fetch code from API Dash here.
</script>
</body>
</html>
```

#### 2. Open Developer Tools
- Chrome: Right-click the page and select "Inspect" or press Ctrl+Shift+I (Windows/Linux) or Cmd+Option+I (macOS).
- Firefox: Right-click the page and select "Inspect Element" or press Ctrl+Shift+I (Windows/Linux) or Cmd+Option+I (macOS).
- Edge: Right-click the page and select "Inspect" or press F12 or Ctrl+Shift+I.

#### 3. Navigate to the Network Tab
Click on the Network tab within the Developer Tools.
Refresh the page to capture all network activity.

![img_1.png](img_1.png)

## JavaScript (axios)

Same steps as [JavaScript (fetch)](#javascript-fetch).

Add the following to `<head>`.
```html
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
```

## node.js (JavaScript, axios)

Expand Down