Magpie backend
Go to file
Blue 89b80f0656
... since it's all just a test - added a try catch on db connection
2023-12-07 17:47:15 -03:00
cmake first thoughts about database 2023-12-07 17:32:43 -03:00
database first thoughts about database 2023-12-07 17:32:43 -03:00
request first thoughts about database 2023-12-07 17:32:43 -03:00
response first thoughts about database 2023-12-07 17:32:43 -03:00
server ... since it's all just a test - added a try catch on db connection 2023-12-07 17:47:15 -03:00
stream Initial setup 2023-11-21 19:19:08 -03:00
CMakeLists.txt first thoughts about database 2023-12-07 17:32:43 -03:00
README.md Some details to readme 2023-11-29 20:25:12 -03:00
main.cpp first couple of requests 2023-11-23 16:57:32 -03:00

README.md

Pica - Backend for Megpie budgeting app

... some description

Prerequisites

  • fcgi
  • nlohmann_json

Building

$ git clone https://git.macaw.me/blue/pica
$ cd pica
$ mkdir build
$ cd build
$ cmake ..
$ cmake --build .

Usage

Webserver

First you need a webserver. In this example I'm going to use apache.

Install apache from your package manager.

Create a file like this in apache config dir (in my case it's /etc/httpd/conf/extra/fcgi-pica.conf)

<Location /pica>
    ProxyPass "unix:/run/pica/pica.sock|fcgi://localhost"
    ProxyPassReverse "http://localhost"
</Location>

Incude this file from apache config file (in my case it's /etc/httpd/conf/httpd.conf)

Include conf/extra/fcgi-pica.conf

Also you need to have 2 modules enabled proxy and proxy_fcgi, usually you need to uncomment following lines in /etc/httpd/conf/httpd.conf

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so

In case you use debian-like distro (ubuntu) you should use a2enmod command instead:

# a2enmod proxy_fcgi

This should enable both modules, because module proxy_fcgi has module proxy as a dependency.

Start apache

$ sudo systemctl start httpd

Creating a directory

Next you need to create a directory for pica socket file

# mkdir /run/pica
# chown <your user> /run/pica

Running an app

At this stage we're redy to run an app

$ cd build
$ ./pica