ejreyme / fizzbuzz

API DEMO

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FIZZ BUZZ API

Small web application that presents a simple REST API.

Application structure

fizzbuzz/           --> root
  build/            --> source files without flow annotations
  src/              --> source files with flow annotations
    fizzBuzz.js     --> pure javascript code base
  reports/          --> artillery reports are saved here
  spec/             --> test location
    fizzBuzzSpec.js --> test for code base
  .babelrc          --> cool stuff
  .exlintrc         --> style guide
  .flowconfig       --> configuration for static code analysis
  .gitignore        --> source control file
  art.yml           --> performance analysis config
  package.json      --> node config
  README.txt        --> please read me!
  server.js         --> node entry point, contains server setup

Prerequisities

Node

Getting Started

$ git clone https://github.com/dabboxking/exercises/fizzbuzz.git
$ cd fizzbuzz

Installing

$ cd fizzbuzz
$ npm install

Running the service

$ npm run dev

Running test

$ npm test

Have jasmine run test after file changes

$ npm run test:watch

Linter

$ npm run lint

Static code analysis (optional)

  1. Add "//@flow" to top of file you want to check
  2. Use the command below to check your file
$ npm run flow

Developing with flow

Transform code during development

$ npm install babel-plugin-transform-flow-strip-types
$ babel --watch=./src --out-dir=./build

Performance Testing

Using Artillery

$ npm install -g artillery
$ npm run dev
$ npm run art

To views reports

$ cd /reports

SECURITY

$ nsp check

3 vulnerabilities found (Regular Expression Denial of Service)

Security Checklist

Node Security Checklist

Additional resources

https://www.owasp.org/index.php/Top_10_2013-Top_10

Consuming

via console

$ curl -X GET "http://localhost:3000/api?word=fizz&max_value=30"

####via browser

  1. Open your favorite browser (EDGE)
  2. Go to http://localhost:3000/api?word=fizz&max_value=30

About

API DEMO


Languages

Language:JavaScript 100.0%