Giter Site home page Giter Site logo

knoodle-react-api's Introduction

Knoodle API

This is a really simple REST Api for the knoodle project.

Requirements

In order to make it work correctly you need the latest version of:

  • docker-ce
  • docker-compose

Installation

$ git clone [email protected]:KnpLabs/knoodle-react-api.git
$ cd knoodle-react-api
$ make install-deps
$ make start

How to use it ?

This api provides simple endpoints:

POST /surveys

Create a new survey. This is an example of json body:

{
    "title": "My awesome survey !",
    "questions": [
        {
            "title": "What's your favorite colour ?",
            "answers": [
                "blue",
                "red",
                "yellow",
                "green",
                "pink",
                "purple"
            ]
        },
        {
            "title": "Do you like chocolate ?",
            "answers": [
                "Yes",
                "No",
                "It depends on my mood",
                "Chocolate ? What's that ?"
            ]
        }
    ]
}

GET /surveys

Return all survey documents. You can filter results with the following filters:

Query String Values
by accept popularity, latest or empty (by title asc).
title string, the content you need in the title
offset integer. Default to 0
limit integer. Default 20

GET /surveys/:surveyId

Retrieve only one survey document.

PUT /surveys/:surveyId

Update a document. Same body as POST /surveys.

DELETE /surveys/:surveyId

Remove an existing survey.

POST /surveys/:surveyId/answers

Create an answer for a given survey. Json body must look like:

{
    "firstname": "John",
    "lastname": "Doe",
    "email": "[email protected]",
    "answers": {
        "<questionId>": "The answer",
        "<questionId>": "The other answer"
    }
}

Loading some fake data

You can load some dataset by running:

$ make load-fixtures

This command will load 30 fake surveys to the database.

knoodle-react-api's People

Contributors

djeg avatar eveyonline avatar lcouellan avatar nicolasmure avatar

Watchers

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