/TravelTogether

PPIL project to create a carpooling web application

Primary LanguagePHP

TravelTogether

PPIL project to create a carpooling web application

How to configure WAMP

Create a Vhost

image In "Nom du Virtual Host" write the name of the api : api-traveltogether

Write the path in the second field to the index.php file. (.../www/TravelTogether/backend).

Leave the last field empty.

Follow the instructions with DNS reload.

Check the Apache modules

image

Restart WAMP if rewrite_module was disabled.

How to configure XAMPP

Linux

check httpd-vhost conf

sudo gedit /opt/lampp/etc/httpd.conf

Check at the line 487-488 and uncomment the line with the Include.

You have to get this line

# Virtual hosts
Include etc/extra/httpd-vhosts.conf

Restart XAMPP

Create custom DNS

Open the hosts file

sudo gedit /etc/hosts

Write the name of your domain like api-traveltogether

127.0.0.1	api-traveltogether

Create the Virtual Host

Go to the httpd-vhost file :

sudo gedit /opt/lampp/etc/extra/httpd-vhosts.conf

At the end of the file paste these lines :

<VirtualHost *>
    DocumentRoot "chemin vers le dossier backend (../../TravelTogether/backend)"
    ServerName api-traveltogether
    
    <Directory "le chemin jusqu'au fichier index.php">
        Order allow,deny
        Allow from all
        Require all granted
    </Directory>
</VirtualHost>

Restart XAMPP

Now you can acces to api from http://api-traveltogether/

Windows

Create the custom domain

Open cmd in Admin Open this file with notepad.exe

notepad.exe \drivers\etc\hosts

Add this line at the end :

127.0.0.1 api-traveltogether

Save and quit notepad

Config Apache hosts

Open the file httpd-vhosts.conf at

C:\xampp\apache\conf\extra\httpd-vhosts.conf

Add these lines :

<VirtualHost *>
    DocumentRoot "chemin vers le dossier backend (../htdocs/TravelTogether/backend)"
    ServerName api-traveltogether
    
    <Directory "chemin vers le dossier backend (../htdocs/TravelTogether/backend)">
        Options FollowSymLinks
        AllowOverride all
        Require all granted
    </Directory>
</VirtualHost>

Save the file and restart XAMP.

Now you can acces to api from http://api-traveltogether/

How to configure the project

Get the project from github

Pull the project in your www folder

git pull github
cd TravelTogether

Create the database and the user

You must be in the folder containing the script.

SOURCE script.sql;

Create the config files

DB config file

touch backend/dbconnect/dbinfos.php

put your db infos in the file like this :

<?php

$login = "your_login";
$password = "your_password";
$url = "same url than js file";

API config file

touch frontend/src/data/url_api.js

write your api url infos :

export const url_api = {
    url: "http://domain_to_api_root",
};

Install Node.js

For Windows

Download Node.js from https://nodejs.org/en/download/

For Linux

wget -qO- https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install -y nodejs

Start the local server

cd frontend
npm install
npm start