airgradient/AirGradientWebApi
James Skemp f96dafe8c9 Fix data format of AirGradient API JSON 2022-11-11 18:52:46 -06:00
..
Migrations Fix data format of AirGradient API JSON 2022-11-11 18:52:46 -06:00
Models Fix data format of AirGradient API JSON 2022-11-11 18:52:46 -06:00
Properties Update API to add non-functional endpoint 2022-11-04 17:48:20 -05:00
.gitignore Add new base minimal web api project 2022-11-04 16:14:46 -05:00
AirGradientWebApi.csproj Add EF Core, models, and initial migration 2022-11-10 23:06:27 -06:00
AirGradientWebApiContext.cs Add EF Core, models, and initial migration 2022-11-10 23:06:27 -06:00
Program.cs Fix data format of AirGradient API JSON 2022-11-11 18:52:46 -06:00
README.md Update API README with database directory info 2022-11-10 23:39:54 -06:00
appsettings.Development.json Add new base minimal web api project 2022-11-04 16:14:46 -05:00
appsettings.json Add EF Core, models, and initial migration 2022-11-10 23:06:27 -06:00

README.md

AirGradient Basic Web API

Requires .NET 6.

Building

dotnet publish -c Release

Setup

The following is for my personal configuration, running on a local server, using nginx and systemd.

First, configure nginx for our dotnet application.

  1. sudo vim /etc/nginx/sites-enabled/default
  2. Add the following:
location /airgradient {
	proxy_pass http://127.0.0.1:5010;
	proxy_http_version 1.1;
	proxy_set_header Upgrade $http_upgrade;
	proxy_set_header Connection keep-alive;
	proxy_set_header Host $host;
	proxy_cache_bypass $http_upgrade;
	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	proxy_set_header X-Forwarded-Proto $scheme;
}
  1. sudo nginx -t
  2. sudo systemctl restart nginx

Next create a directory for the Web API.

  1. sudo mkdir /var/www/airgradient/html
  2. sudo chown -R www-data:www-data /var/www/airgradient/html

Create a directory for the database:

  1. sudo mkdir /var/www/airgradient/Database
  2. sudo chown -R www-data:www-data /var/www/airgradient/Database

Copy files from local to remote:

  1. scp -r .\bin\Release\net6.0\publish\* user@<server>:/var/www/airgradient/html
  2. scp -r .\Database\* user@<server>:/var/www/airgradient/Database