Go to file
Elis Hirwing 0fcb399960
readme: Document how to run the project
2019-01-26 12:02:43 +01:00
public src: Add method to put new items into the inventory 2019-01-26 11:16:29 +01:00
src/Etu src: Add method to put new items into the inventory 2019-01-26 11:16:29 +01:00
.envrc Add direnv and nix shell stuff for environment 2019-01-26 09:23:10 +01:00
.gitignore src: Add a sqlite database 2019-01-26 10:20:29 +01:00
README.org readme: Document how to run the project 2019-01-26 12:02:43 +01:00
composer.json composer: Install guzzle 2019-01-26 11:41:27 +01:00
composer.lock composer: Install guzzle 2019-01-26 11:41:27 +01:00
repl.php repl: Add prompt 2019-01-26 11:57:08 +01:00
shell.nix Add direnv and nix shell stuff for environment 2019-01-26 09:23:10 +01:00

README.org

Usage

I've provided an .envrc for direnv which uses nix-shell to load shell.nix which provides the dependencies needed to run the project.

But it's not required to use nix-shell since the only deps are php of a version 7.2 or newer and composer.

It's required to run composer install in this directory before starting the webserver and then running the repl pointing to the webserver.

The database is a sqlite database which ends up in sqlite.db in the root directory of the project.

Run the webserver

php -S localhost:8000 -t public/

Run the repl

php repl.php http://localhost:8000

API docs

Request stock by item name

curl http://localhost:8000/inventory/item-name

Bring stock down by item name

curl -X DELETE http://localhost:8000/inventory/item-name/amount

Increase stock by item name

curl -X PUT http://localhost:8000/inventory/item-name/amount