Added backend and refactored frond-end to support it.
* Removed unecesery home page * Added PHP Api that provides auth and replaces the json-server for data storage * Added support for alternate geocode-api * Added registration page
This commit is contained in:
17
api/calls/get_items.php
Normal file
17
api/calls/get_items.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
session_start();
|
||||
if (!isset($_SESSION['name'])) {
|
||||
http_response_code(401);
|
||||
echo json_encode(['message' => 'Unauthorized']);
|
||||
die;
|
||||
}
|
||||
|
||||
require_once 'config/db.php';
|
||||
|
||||
$query = "SELECT * FROM items";
|
||||
$stmt = $pdo->prepare($query);
|
||||
$stmt->execute();
|
||||
|
||||
$items = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
echo json_encode($items);
|
||||
Reference in New Issue
Block a user