https://github.com/4cecoder/c-server-go-client
https://github.com/4cecoder/c-server-go-client
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/4cecoder/c-server-go-client
- Owner: 4cecoder
- License: mit
- Created: 2024-01-18T16:25:36.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-08T14:11:39.000Z (about 2 years ago)
- Last Synced: 2025-01-05T16:29:46.445Z (about 1 year ago)
- Language: C
- Size: 2.72 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# C-Server-Go-Client
## Server in C
## Requirements
- sqlite3
- libmircohttpd
- jansson
- gnutls
- libcurl-gnutls
- zlib
- ulfius
## Running the server
### Build & Run
### Check if running
Go to `http://localhost:8080/api` and see if there is a response in browser
### Windows
Run `docker-compose up -d`
### Linux
Theres a sh file for linux to run a build based on the cmake
## Endpoint Curl Usage:
### Get all patients
`curl -X GET http://localhost:8080/api/patients`
### Get a specific patient (replace {patientID} with an actual patient ID)
`curl -X GET http://localhost:8080/api/patients/{patientID}`
### Create a new patient
`curl -X POST -H "Content-Type: application/json" -d '{"name": "John Doe"}' http://localhost:8080/api/patients`
### Update a specific patient (replace {patientID} with an actual patient ID)
`curl -X PUT -H "Content-Type: application/json" -d '{"name": "Updated Name"}' http://localhost:8080/api/patients/{patientID}`
### Delete a specific patient (replace {patientID} with an actual patient ID)
`curl -X DELETE http://localhost:8080/api/patients/{patientID}`
# Client in Go
Install golang
Go into the client folder
`cd client`
Run client
`go run main.go`
Go to http://localhost:8081/ in the browser