Coder Social home page Coder Social logo

dbc-quizzes's Introduction

quizzes

This app exposes an API for a simple quiz appication.

Your mission: build a one-page app using (at least) jQuery, Javascript, and AJAX to render questions to the user, allow her to submit answers, tell her whether or not her submitted answer was correct, and give her her final correct / incorrect tally.

Fork this repo to get started!

APIs

Get Quizzes

Request

GET /quizzes.json

Response

{
  quizzes: [
    {
      quiz_id: 1,
      name: "Random Stuff"
    },
    {
      quiz_id: 2,
      name: "Javascript Questions"
    }
  ]
}

Get Next Question

Request

GET /quizzes/1/questions/next.json

Request Data

Every request (except listing quizzes) must pass a "session_key" which uniquely identifies the particular user taking the quiz. The session key should be a unique string. Simply generate something unique-ish from Javascript and be sure to package it along with any other data you send to the API.

{ session_key: 'a124f87dec55da23' }

Response

{
  question: {
    quiz_id: 1,
    question_id: 1,
    question: "Did your mom go to college?",
    choices: [
      {
        quiz_id: 1,
        question_id: 1,
        choice_id: 12,
        choice: "Yes"
      }, 
      {
        quiz_id: 1,
        question_id: 1,
        choice_id: 13,
        choice: "No"
      }
    ]
  }
}

Submit Answer

Request

POST /questions/1/answers.json

Request Data

{ session_key: 'a124f87dec55da23', choice_id: 12 }

Response

{
  status: {
    quiz_id: 1,
    question_id: 1,
    more_questions: true,
    correct: false,
    submitted_choice_id: 12,
    correct_choice_id: 13,
    num_correct: 0,
    num_incorrect: 1
  }
}

dbc-quizzes's People

Contributors

jeffreywescott 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.