Giter VIP home page Giter VIP logo

task-02's Introduction

Task 2 - URL-Shortner


Installation

  1. Run compose install in order to install required packages.
  2. Run below command to serve the project locally.
    php -S localhost:8000 -t ./public
    

Configuration

  1. The root directory of application contains a .env.example. Rename the .env.example file to .env.
  2. Set the application key (APP_KEY) to a randomly generated 32 characters long string in .env file. If the application key is not set, the user encrypted data will not be secure!

Authentication

For the authentication, I decided to go with JWT.

  1. JWT works with a secret key. Add a 30 characters random string to the JWT_SECRET as:
    JWT_SECRET=uflWMsDJdKFLge6pjX0qLBJvdDUHJK
    

Database

  1. Create a SQLite database by using the touch database/database.sqlite command. Configure the environment variables to point to this newly created by using the database's absolute path and commenting unnecessary variables out.

    DB_CONNECTION=sqlite
    #DB_HOST=127.0.0.1
    #DB_PORT=3306
    DB_DATABASE=/absolute/path/to/database.sqlite
    #DB_USERNAME=homestead
    #DB_PASSWORD=secret
    
  2. Run all of the migration files by executing migrate Artisan command:

    php artisan migrate
    

Queues

This project makes use of Redis queue driver to have faster redirection and defer processing clicks task. So make sure you have redis installed on your operating system. If not you can visit Redis Download page to have installed.

  1. Change Redis-related environment variable in .env file as stated below:
    QUEUE_CONNECTION=redis
    
    and
    REDIS_CLIENT=predis
    
  2. Run redis-server in your terminal to start Redis.
  3. Run Queue worker so as to process the jobs (here we have only one job and that is named ProcessClick). You may run the worker using the queue:work command:
    php artisan queue:work
    

Postman Collection

Follow this Link to access API collection in Postman or this Published Documents Link in order to access it in your browser.

task-02's People

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.