footnotes-api
Collection of APIs for the FootNotes(tm) web application which tracks users, hiking locations and specific hikes that people go on and want to track.
NOTE: This needs to currently be installed on PHP7.4.x or lower. The library that powers this api does not work with PHP 8.
APIs
USERS
- GET /user - get all users
- GET /user/1 - get a specific user with ID of 1
- POST /user - add new user
- PUT /user/1 - update user 1
- GET /serachuser/username/jsmith - search any column (userId, username, fullname, status, email) in the user table
Example usage
localhost/?/fnapi/user
- gets all the users in the table
LOCATIONS
- GET /location - get all locations
- GET /location/2 - get a specific location with locationId of 2
- POST /location - add new location
- PUT /location/2 - update location 2
- GET /locationsearch/name/examplename - search any column (locationId, description, name, directions)
Example usage
localhost/?/fnapi/location
- gets all the locations in the table
HIKES
- GET /hike - get all hikes
- GET /hike/2 - get a specific hike with hikeId of 2
- POST /hike - add new hike
- PUT /hike/2 - update hike 2
- GET /hikesearch/name/examplename - search any column (locationId, userId,description, hikeDate)
Example usage
localhost/?/fnapi/hike
- gets all the hikes in the table
Setup
-
Install some XAMP stack with apache, PHP 7.4.x, mariaDB
-
On mariaDB, create a database called 'footnotes-db'. Deploy the /inc/footnotes.sql file on your 'footnotes-db' database.
-
Clone this repo into your working html directoy such as /var/www/html/
-
Using the /inc/cred.sample.txt file, make your own cred.txt file in the /inc directory and fill out the db information such as user, password, host, and db name.
-
With your server running, you should be able to type the following in your web browser and see some results:
-
localhost/fnapi/?/location
-
localhost/fnapi/?/user
-
In the above example the fnapi directory is an alias defined in the httpd.conf file:
Alias /fnapi/ /var/www/html/fn/
<Directory "/var/www/html/fn/">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
-