Giter Site home page Giter Site logo

buzz-word-bingo's Introduction

Buzz Word Bingo

A Buzz Word Tracker

You're being asked to write a buzzword tracker that can keep track of buzzwords, the amount of points for a buzzword being spoken aloud, and the total amount of points overall. This system should keep track of at most 5 buzzwords. The intention is to load the system with at most 5 buzzwords and if any of those 5 buzzwords are spoken during a conversation, the matching amount of points is added to a "total point count" managed by the system.

Welcome to Team Buzz™

Our system has been getting a lot of traction and we need to rebuild the API server with NodeJS to handle all the connections, we need you to create the server using ExpressJS. Our CTO will provide you with the specs below.

At this time:

  • you will not build the front-end.
  • you will not implement a database.

The Specs

We like RESTful architecture. We like CRUD. As always, data will be sent to the server as x-www-form-urlencoded.

Creating Buzzwords

This is how your buzzword objects should look like after receiving a POST to the URI /buzzword

{
  buzzWord: String,
  points: Number
}

You will store these objects in memory for the time being. Meaning that if the server crashes and after restarting and listening again, your app will have no buzzword objects, no collection containing buzzword objects, no scores, nada.

Routes overview table:

METHOD ROUTE (URI) BODY RESPONSE Action
GET / empty render HTML index.html serves the index.html
GET /buzzwords empty { "buzzWords": [...] } A JSON response containing an array of current buzz words Retrieves all buzzwords
POST /buzzwords { "buzzWord": String, "points": Number } { "success": true } Creates a new buzzword object. Returns true if successful else false
PUT /buzzwords { "buzzWord": String, "points": Number } { "success": true } Updates a buzzword's point value. Returns true if successful else false
DELETE /buzzwords { "buzzWord": String } { "success": true } Delete a buzzword. Returns true if successful else false
POST /reset { "reset": true } { "success": true } Resets the server. All buzzwords are removed and total scores reset to 0
POST /heard { "buzzword": String } { "totalScore": Number } Marks that a buzzword has been heard and should update the total score. Returns the new total score if successful otherwise returns just false

Routes detailed

GET /: Serves the static file index.html which should be located in your public/ directory. For now just have a stub HTML file.

GET /buzzwords: Returns a JSON response containing single key, buzzWords which will be an array containing objects (see Buzz Word Object Section for details)

POST /buzzwords: Creates a new buzz word object. The body should have these keys:

  • buzzWord which contains the buzz word as a String and
  • points property is how many points that word is worth when scored, this value is of data-type Number. Example: if { "buzzword": "Agile is amazing", "score": 1000 } is sent to this route then the server will create a new buzz word object and add it to a collection.

PUT /buzzwords: Updates a buzz word's points value. The body should contain these keys:

  • buzzWord which is the buzz word to modify as a String.
  • points Changes the value of the buzz word's points property, this should be of datatype Number.
    Example:
    if { "buzzWord": "Social-Mobile", "points": 100 } is sent to this route then the server will find the buzz word "Social-Mobile" and change it's points property to 100. It should then return true. If the buzzword is not found, false should be returned.

DELETE /buzzwords: Deletes a buzz word from the collection.

POST /reset: Reset the total score to 0 and remove all buzzwords from the server.

POST /heard: Increments the total score by the point value assigned to the buzzword given.

Score?

For now, it's up to you on how you keep track of the user's score.

Middleware to use

Body-Parser - Use this module to help parse the data coming from a request. Focus on the urlencodedoptions section of the README, use the extended: true option. Take some time to scan through the documentation. What is body-parser module doing for us? Is this module doing something we previously had to do manually?

Getting Started

  1. Fork and clone this repo.
  2. You'll be using git and npm so be sure to initialize those tools before you use them.
  3. Install the packages you need
  4. Use Postman to test your routes.
  5. Remember to commit often!

buzz-word-bingo's People

Contributors

jaywon avatar joekarlsson avatar sgnl avatar taesup 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.