Skip to content

pcoyoy8/imagesApi

Repository files navigation

README

  1. Go to the project folder

  2. Provide the right permissions for the storage folder. Reference: https://stackoverflow.com/questions/30639174/how-to-set-up-file-permissions-for-laravel For test purposes, you can use 775 or 777.

  3. Assign the right owner and group for public/uploads and public/download. In apache is www-data:www-data. Validate permissions for your environment

  4. Create your .env file

  5. Add the database, queue and url configuration

    APP_URL=http://images.local
    
    QUEUE_CONNECTION=database
    
    DB_CONNECTION=mysql
    DB_HOST=127.0.0.1
    DB_PORT=3306
    DB_DATABASE=images
    DB_USERNAME=root
    DB_PASSWORD=12345678
    
  6. In the terminal run the command:

    php artisan migrate
    
  7. In the terminal run the command (if you don't execute this command the queue will not be available)

    php artisan queue:work
    

Notes

You must to create your own virtualhost, set the DocumentRoot (example)

DocumentRoot /var/www/html/jokes/public/

and provide the following permissions

<Directory PROJECT_LOCATION>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Require all granted
</Directory>

The mod_rewrite should be enabled.

Here un example:

<VirtualHost *:80>
        ServerAdmin [email protected]
        ServerName images.local
        ServerAlias www.images.local
        DocumentRoot /var/www/html/imagesApi/public/

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        <Directory /var/www/html/imagesApi/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Require all granted
        </Directory>
</VirtualHost>

Reference: https://www.digitalocean.com/community/tutorials/how-to-rewrite-urls-with-mod_rewrite-for-apache-on-ubuntu-18-04

Client

For testing the API you can use Postman and import the file that is located in public/resources/ImagesAPI.postman_collection.json

There are 3 methods:

  • getAll: retrieve all the records
    • HTTP Method: GET
  • getById: retrieve one record by Id
    • HTTP Method: GET
    • Parameters:
      • id: integer
  • store: insert and/or update the records
    • HTTP Method: POST
    • Parameters:
      • file: csv

For testing the application you can use the CSV file, located in public/resources/images_data.csv

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published