GithubHelp home page GithubHelp logo

canix's Introduction

Simple JSON API

The task was to write a simple backend JSON API that requests data from an external server based on user requests, using the Rails framework. This was implemented as an API controller via Rails, with the addition of multi-threaded requests and response data caching.

Author's note: This is my first Ruby & Rails program (usage), so there's likely coding improvement possible. In the debugging process, I also spun up a ticket about the type of content Rail's cache can store. That's tracked here: rails/rails#44982

Setup

Run bundle install in the directory to load all the Gems and dependencies.

Run rails server to test the API on localhost default port 3000

Run rails test for Minitest

API

localhost:3000/api/ping - test that it's working, should return a success response json

localhost:3000/api/posts - grab all the unique 'post' objects from https://api.hatchways.io/assessment/blog/posts

  • (required) ?tags=___ - comma-delimited, 1 or more tag associated with posts
  • (optional) &sortBy=___ - ['id', 'reads', 'likes', 'popularity'] sorting category
  • (optional) &direction=___ - ['asc', 'desc'] sorting order

Any other paths will redirect you to root / with 404.

canix's People

Contributors

cwli24 avatar

Watchers

 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.