Skip to content

Commit

Permalink
Create README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
zafs23 authored Oct 5, 2024
1 parent 3a413e4 commit eb46eac
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
## Simple Go Server
This project builds a simple server built in Go (Golang) which listens to a TCP server on localhost:$Port and processes client requests.

### Getting Started
Before running this project on your local machine for development and testing, complete the following steps.

#### Prerequisites
Before running the server, have Go and Git installed on your machine. The project is built on ```Go version 1.22.0.```
[Go installation offical website](https://go.dev/learn/)
[Git installtion](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)

#### Installation
To set up the project, clone the repositoy to your local machine:
```
git clone https://github.com/zafs23/Go-Server.git
cd Go-Server
```
Then, run the server using:
```
go run main.go
```
The server will listen to http://localhost:3000. But additional ports can be added to the main.go.

### Services
This server accepts a task request terminated by a new line to execute a command where the command absolute path is given in a JSON format.
Client-side task request format:
```json
{
"command": ["./cmd", "--flag", "argument1", "argument2"],
"timeout": 500
}
```
Upon receiving and accepting a request, the server will handle the task and return a response.
Task result (server response) format:
```json
{
"command": ["./cmd", "--flag", "argument1", "argument2"],
"executed_at": 0,
"duration_ms": 0.0,
"exit_code": 0,
"output": "",
"error": "",
}
```
The server processes the task requests in parallel. It can accept and start processing multiple requests in parallel, but the scheduler handles each task synchronously.

#### Testing
To execute the automated tests, run the following command from the project directory:
```
go test ./test/...
```

0 comments on commit eb46eac

Please sign in to comment.