Skip to content

SotolitoLabs/TourMasters

Repository files navigation

TourMasters

Application for managing tours

Dependencies

podman, make, rust, cargo, libpq

Dependency Installation

Mac OS X

Rust

$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
$ export PATH=$PATH:~/.cargo/bin

Podman

Using brew:

$ brew install podman

libpq

libpq is the client library for PostgreSQL

Installation using brew.

$ brew install libpq

Development

Run it

make run

Test

  • Get JWT token
TOKEN=$(curl -s --request POST --data '{"user": "test", "password": "prueba123"}' http://127.0.0.1:8000/login | jq -r '.token')
  • Add a venue using an authenticated user
$ curl -X POST -H "Authorization: Bearer $TOKEN" \
    -H 'Content-type: application/json' \
    -d @api_data/new_venue.json http://127.0.0.1:8000/venues/add
  • List venues
$ curl http://127.0.0.1:8000/venues
  • Get a venue
$ curl http://127.0.0.1:8000/venues/af20c605-c8e2-4c33-8311-2ff4b77991aa
  • Delete a venues
$ curl -H "Authorization: Bearer $TOKEN" -X DELETE \
    http://127.0.0.1:8000/venues/af20c605-c8e2-4c33-8311-2ff4b77991aa
  • Get a static file

Static files are located in the www/static and are served by the /public API endpoint. If you wish to serve a text, html, image, css or any static item just copy it to the www/static directory.

$ curl http://127.0.0.1:8000/public/test.txt
``