Git Product home page Git Product logo

pushkin-api's Introduction

Pushkin-API

Overview

API Server is a light express server that defines the routes accessable to the client.

Core Features

  • All routes are listed in server.js
  • Remote Procedure calls are wrapped in a Promise
  • RPC api is a javascript object with a method to be called, and the arguments that you want passed to it.
  • All errors are logged using winston

Routes Table

URL Method Body Description
/api/response POST { choiceId, userId, questionId } Saves a user’s response in the DB, returns the next question
/api/users/:id PUT {} Updates a user with any information sent
/api/trials GET n/a Returns an array of all the Trials available
/api/initialQuestions GET n/a Calls the initialQuestions method in pushkin worker, returns the response
/api/languages GET n/a returns an Array of all the Languages on the server
/api/users/:userId GET n/a Gets all the results for that specific user
/api/users GET n/a An array of all users in system
/api/comments POST { userId, primaryLanguages[], nativeLanguages[] } Updates the user, sets their primary and nativeLanguages
/api/admincsv GET Requires basic HTTP Auth based on usernames and passwords stored in admin.txt, Returns a CSV dump of response data. Customize Worker#getResponseCsv to change the data returned
/api/results/:userId GET Returns the top languages for a specific user, returns the results of Worker#getResults .

Get started

Clone the parent repo with the docker-compose file, insure that DB tables and seeds have been ran.

  • to run the seeds, use docker ps get the process id for pushkin_db and execute docker exec -it PROCESS_ID node seeder.js
  • remember you can shell into a docker container at any time

Make a request to localhost/api/initialQuestions to test this api.

Extension

  • Feel free to modify the logging mechanism
  • Build and define new express routes.

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.