Skip to content
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
8be0615
Added go server
priankakariat Oct 4, 2024
4be4456
Added readme for go server
priankakariat Oct 4, 2024
95b2d7e
Fixed documentation and read me of go files
priankakariat Oct 4, 2024
a7bc461
Updated readme for go server
priankakariat Oct 4, 2024
0231060
Updated documentation of json.go
priankakariat Oct 4, 2024
bb41cba
Updated formatting of license in go files
priankakariat Oct 4, 2024
233135c
Added cors middleware handler to go server
priankakariat Oct 4, 2024
c2ffef4
Fixed readme for go server
priankakariat Oct 4, 2024
c0b4793
Update README.md
priankakariat Oct 4, 2024
e6ae3ac
Update README.md
priankakariat Oct 4, 2024
b6e7341
Update README.md to skip to manual install for Go
priankakariat Oct 4, 2024
6b4c610
Update README.md
priankakariat Oct 4, 2024
f8cb2af
Update README.md
priankakariat Oct 4, 2024
a4d7518
Update README.md
priankakariat Oct 4, 2024
f2328a4
Update README.md
priankakariat Oct 4, 2024
9e82320
Update README.md
priankakariat Oct 4, 2024
9e383b5
Update README.md
priankakariat Oct 4, 2024
873f294
Update README.md
priankakariat Oct 4, 2024
7f68b8d
Update README.md
priankakariat Oct 4, 2024
7235a45
Update README.md
priankakariat Oct 4, 2024
61dbb0f
Update README.md
priankakariat Oct 4, 2024
af01e1f
Update README.md
priankakariat Oct 4, 2024
54e4b23
Update README.md
priankakariat Oct 4, 2024
46a2d48
Updated documentation of main.go
priankakariat Oct 4, 2024
5c5a7fd
Merge branch 'server-go' of https://github.com/priankakariatyml/examp…
priankakariat Oct 4, 2024
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
21 changes: 15 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
- [Intro](#intro)
- [API documentation](#api-documentation)
- [Installation](#installation)
- [Using bash script(Linux/macOS)](#using-bash-scriptlinuxmacos)
- [Using bash script for Node.js/Flask on Linux/macOS](#using-bash-script-for-nodejsflask-on-linuxmacos)
- [Install manually(Linux/macOS/Windows)](#install-manuallylinuxmacoswindows)
- [nvm(Node Version Manager) installation](#nvmnode-version-manager-installation)
- [Node.js installation](#nodejs-installation)
- [Flask installation](#flask-installation)
- [Go installation](#go-installation)
- [Run the app](#run-the-app)
- [Run React client](#run-react-client)
- [Run backend server](#run-backend-server)
Expand All @@ -34,7 +35,7 @@ Streaming mode uses Gemini's streaming capability to achieve faster interactions
The client for this app is written using [React](https://react.dev/) and served using [Vite](https://github.com/vitejs/vite).

### Backend
The app currently has 2 different backend servers that the user can choose from, [Flask](https://flask.palletsprojects.com/en/3.0.x/quickstart/) and [Node.js](https://Node.js.org/en).
The app currently has 3 different backend servers that the user can choose from, [Flask](https://flask.palletsprojects.com/en/3.0.x/quickstart/), [Node.js](https://Node.js.org/en) or [Go](https://go.dev)

## API documentation
### Endpoints available
Expand Down Expand Up @@ -91,8 +92,8 @@ This is the <b>streaming</b> POST method route. Use this to send the chat messag
## Installation
Click [here](#windows) to skip to installation on Windows.

For Linux/macOS a setup bash script is available for easy installation. If you prefer installing manually you can skip to [next section](#install-manuallylinuxmacoswindows).
### Using bash script(Linux/macOS)
If your choice of backend is Node.js or Flask, for Linux/macOS a setup bash script is available for easy installation. The bash script does not support installation of Go. If you wish to use Go as your backend or prefer installing manually, you can skip to the [next section](#install-manuallylinuxmacoswindows).
### Using bash script for Node.js/Flask on Linux/macOS
#### Make the script executable
```
chmod +x setup.sh
Expand Down Expand Up @@ -168,6 +169,14 @@ You can quickly install the required packages using the `package.json` file.
pip install -r requirements.txt
```

#### Go installation

Check if Go is already installed on your system.
```
go version
```
If Go is not installed, follow the instructions for your operating system from the [official Go installation guide](https://go.dev/doc/install).

## Run the app
To launch the app you have to perform the following steps:
1. Run React client
Expand Down Expand Up @@ -248,12 +257,12 @@ You must set the API key as an environment variable while running the applicatio

###### Running the Application
1. Navigate to the app directory, `server-go` (i.e. where main.go is located).
2. Run the application using the following command:
2. Run the application with the following command.
```
GOOGLE_API_KEY=<your_api_key> go run .
```
The server will start on `localhost:9000`.
By default, the app will run on port 9000. You can modify the port the server listens on by setting the environment variable `PORT`.
By default, the server starts on port 9000. You can override the default port the server listens on by setting the environment variable `PORT` in the command above.

## Usage
To start using the app, visit [http://localhost:3000](http://localhost:3000/)
Expand Down
4 changes: 2 additions & 2 deletions server-go/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Gemini chat app with Go

## Install Go
To run this app, Go must be installed on your system.
To run this server, Go must be installed on your system.
Check if Go is already installed.
```
go version
Expand All @@ -14,7 +14,7 @@ You need a Gemini API key to run the server,
If you don't have a Gemini API key ready, you can create a key with one click in [Google AI Studio](https://aistudio.google.com/app/apikey).

1. Navigate to the app directory, `server-go` (i.e. where main.go is located).
2. Run the application with the following command:
2. Run the application with the following command.
```
GOOGLE_API_KEY=<your_api_key> PORT=<your_port> go run .
```
Expand Down