descriptionELECTRONIC VOTE REST API SERVER (school project)
owneras2023.mta5x@slmail.me
last changeWed, 11 Oct 2023 02:39:28 +0000 (10 23:39 -0300)
content tags
add:
README.md

VOTAR REST API

POST   /candidates {"name":string} -> {"id":number,"name":string}
DELETE /candidates/id
GET    /candidates -> [{"id":number,"name":string}]
DELETE /candidates
POST   /vote {"id":number}
GET    /report -> [{"id":number,"name":string,"votes":number}]

SQLite

Primero hay que instalar sqlite.

En mi caso (termux), el comando para instalar SQLite es:

$ pkg install sqlite

Controlar que SQLite esté habilitado en PHP.

$ php -i | grep -i 'sqlite' | grep -i 'ena'
PDO Driver for SQLite 3.x => enabled
SQLite3 support => enabled

Crear la base de datos con el siguiente comando:

$ sqlite3 database.sqlite < votar.sql

En la siguiente página se puede aprender un poco más sobre SQLite: SQLite PHP.


Container Image

Build (docker/container) image

docker build --rm \
    --tag 'edi2/server' \
    .

Run PHP server

docker run --tty --interactive --rm \
    --name edi2-server \
    --publish 8080:80 \
    edi2/server
shortlog
2023-10-11 Juan ManuelMake `preflight` request pass okaymaster
2023-10-11 Juan ManuelDocument how to build and run container image
2023-10-11 Juan ManuelCreate Dockerfile
2023-10-11 Juan ManuelLogic to handle "GET Report"
2023-10-11 Juan ManuelLogic to handle "POST Vote"
2023-10-11 Juan ManuelLogic to handle "DELETE Candidates" (all)
2023-10-11 Juan ManuelLogic to handle "GET Candidates"
2023-10-11 Juan ManuelLogic to handle "DELETE Candidates ID"
2023-10-11 Juan ManuelLogic to handle "POST Candidates"
2023-10-11 Juan ManuelReset database before running the tests
2023-10-11 Juan ManuelERD: Diagrama de Relaciones de Entidades
2023-10-11 Juan ManuelDFD: Diagrama 1.0
2023-10-11 Juan ManuelDFD: Diagrama 0.0
2023-10-11 Juan ManuelDFD: Diagrama de Contexto
2023-09-21 Juan ManuelCreate `.gitignore` file
2023-09-21 Juan ManuelUpdate README file
...
heads
13 months ago master
13 months ago 00_diagramas
13 months ago 06_get_report
13 months ago 05_post_vote
13 months ago 04_delete_candidates
13 months ago 03_get_candidates
13 months ago 01_post_candidates
13 months ago 02_delete_candidates_id