Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sqrrrrl/pc-power-api
A Go REST API designed to communicate with an arduino controlling a computer's power state
https://github.com/sqrrrrl/pc-power-api
Last synced: about 2 months ago
JSON representation
A Go REST API designed to communicate with an arduino controlling a computer's power state
- Host: GitHub
- URL: https://github.com/sqrrrrl/pc-power-api
- Owner: sqrrrrl
- License: gpl-3.0
- Created: 2024-06-11T15:13:51.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-07-18T17:42:17.000Z (5 months ago)
- Last Synced: 2024-10-17T04:08:03.149Z (2 months ago)
- Language: Go
- Size: 67.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# What is this?
This is the REST API component of a three-parts project where an API,
an [arduino](https://github.com/sqrrrrl/pc-power-arduino)
and a [mobile app](https://github.com/sqrrrrl/pc-power-app) communicate together
in order to enable users to remotely control the power state of their desktop computer(s).# Installation
1. Download and install [golang](https://go.dev/doc/install)
2. Clone the repository:
```
git clone https://github.com/sqrrrrl/pc-power-api.git
```
3. Navigate to the project directory and download the dependencies:
```
go mod download
```
4. Build the project:
```
go build -v -o ./outputDirectory/appName ./src/app
```# Usage
## Environment variables
Some environment variables need to be set for the API to work properly:\
```PORT```: The port which the API should listen to\
```JWT_SECRET```: A random 32 characters string used to generate the authentication tokens\
```DBTYPE```: Either sqlite or mysql\
```DBNAME```: The name of the database\
\
The environment variables required to use mysql:\
```DBUSER```: The username of the database.\
```DBPASS```: The password of the database.\
```DBHOST```: The ip address or domain of the database.\
```DBPORT```: The port of the database.## Starting the API
Once the environment is set the API can be started by executing the compiled project:
```
./outputDirectory/appName
```# License
Distributed under the [GPL-3.0 license](https://github.com/sqrrrrl/pc-power-api#GPL-3.0-1-ov-file)