Skip to content

Latest commit

 

History

59 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What is this?

This is the REST API component of a three-parts project where an API, an arduino and a mobile 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
  2. Clone the repository:
git clone https://github.com/sqrrrrl/pc-power-api.git
  1. Navigate to the project directory and download the dependencies:
go mod download
  1. 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

About

A Go REST API designed to communicate with an arduino controlling a computer's power state

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages