maximebourdel / bourses-api

API for a Symfony3 projects restituing a list of 16 000 stocks

Home Page:http://bourses-online.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bourses API


Installation

Arborescence

L'arborescence doit être la suivante :

/var/www/html/bourses : - api (repository bourses-api) : - front-office (repository bourses-front-office)

Clonage

Lancer la commande suivante :

$ git clone https://github.com/maximebourdel/bourses-api.git

Fichier parameters.yml

Le fichier est à déposer dans /app/config fichier parameters.yml

# This file is auto-generated during the composer install
parameters:
    database_host: 127.0.0.1
    database_port: null
    database_name: bourses
    database_user: root
    database_password: root
    mailer_transport: smtp
    mailer_host: 127.0.0.1
    mailer_user: null
    mailer_password: null
    secret: ????????????????
    cors_allow_origin: http://localhost
    api_name: YahooFinanceAPI
    api_description: Cette API permet d'interagir avec le Modèle des Bourses

Installation de la base de données et des tables

$ cd /var/www/html/bourses/api
$ php bin/console doctrine:database:create
$ php bin/console doctrine:schema:update --force

Import des librairies

La commande suivante va installer les librairies :

$ composer update

Vérification : la commande suivante ne doit pas retourner d'erreur

$ php bin/console

Autoriser les accès depuis n'importe quel serveur

Dans le répertoire web pour le fichier app_dev.php : Supprimer les lignes

// This check prevents access to debug front controllers that are deployed by accident to production servers.
// Feel free to remove this, extend it, or make something more sophisticated.
if (isset($_SERVER['HTTP_CLIENT_IP'])
    || isset($_SERVER['HTTP_X_FORWARDED_FOR'])
    || !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1']) || php_sapi_name() === 'cli-server')
) {
    header('HTTP/1.0 403 Forbidden');
    exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
}

Configurer apache2

Dans le répertoire /etc/apache2 dans le fichier apache2.conf , et ajouter à la fin du fichier :

<VirtualHost *:80>

    ServerName bourses-online.com
    ServerAlias www.bourses-online.com

    Alias /api /var/www/html/bourses/api/web

    DocumentRoot /var/www/html/bourses/front-office/dist

    <Directory /var/www/html/bourses/front-office/dist>
        AllowOverride None
        Order Allow,Deny
        Allow from All

        RewriteEngine on

        # Don't rewrite files or directories
        RewriteCond %{REQUEST_FILENAME} -f [OR]
        RewriteCond %{REQUEST_FILENAME} -d
        RewriteRule ^ - [L]

        # Rewrite everything else to index.html
        # to allow html5 state links
        RewriteRule ^ index.html [L]


    </Directory>

</VirtualHost>

Redémarrer ensuite apache :

$ sudo service apache2 restart

About

API for a Symfony3 projects restituing a list of 16 000 stocks

http://bourses-online.com

License:MIT License


Languages

Language:PHP 94.1%Language:ApacheConf 5.9%