Git Product home page Git Product logo

codechallenge's Introduction

Steps for install:

  • clone app git clone https://github.com/rach7110/codeChallenge

  • cd into app folder

  • run composer install

  • copy .env.example to .env. Make sure environment variables are correct:

    DB_CONNECTION=sqlite
    
    WEATHER_API_ID={your secret api key} 
    
  • generate an app key php artisan key:generate

  • create a sqilite database with command touch database/database.sqlite

  • run the migration command to setup the database scheme php artisan migrate

  • start the server php artisan serve

  • Open your browser and visit localhost:8000

Part 1: Local API

  • Routes to view all todos, view one todo, and create, edit or delete a todo can be found in routes/web.php
  • To create a todo, make sure to enter a URL in the following format http://localhost:8000/todos/create?item={"task":"go to the store", "completed":false}
  • To edit a todo, make sure to enter a URL in the following format http://localhost:8000/todos/{id}/edit?item={"task":"go to the store", "completed":true}
  • Logs - a table exists with a log of: request method, route being accessed, as well as the HTTP status code that the request returns. To view these logs, you may use Tinker.
    php artisan tinker
    $logs = App\RequestLog::all();
    

Part 2: External API

  • To request weather using a valid United States zip code, visit /weather and enter the zip as a query parameter. Example http://localhost:8000/weather?zip=78704
  • If a status code of 418 is returned, you enterd an invalid zip code. The 418 code is actually a spoof. This error is a reference of Hyper Text Coffee Pot Control Protocol which was an April Fools' joke in 1998.

Part 3: Testing

  • Unit tests for Part 2 exist in /path to app/tests/Unit/OpenWeatherServiceTest.php
  • Execute test with command phpunit tests/

codechallenge's People

Contributors

rach7110 avatar

Watchers

James Cloos avatar  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.