Git Product home page Git Product logo

hapi-project's Introduction

hapi-project

Website hosted on Heroku here.

Build Status codecov Code Climate Issue Count

homepage mockup results mockup

Original mockup

UX Prototype

What?

  • Create a templated web app using hapi
  • Utilise 2 APIs - random name generator and nomad - finding working and living space
  • Strong test coverage

User Story

General User Story

As... someone who wants to start a new life I want to... be able to create a new identity and get suggestions on where to start my new life.

Broken-down User Stories

As an... ex-convict I want to... be able to create a new name so that... I can recreate myself.

As a... witness (in a court trial) I want to... find somewhere to stay so that... I have a roof over my head whilst escape the criminals trying to hunt me down.

As a... bad spouse who has been thrown out I want to... find somewhere to work so that... I can earn some cash whilst I move around and re-piece my relationship.

As a... spy I want to... be able to create a new identity (job/ phone no etc) so that... I can trick the people I encounter and obtain crucial insider information.

Different users get different results based on their appetite for risk and budget. Spies are looking for somewhere cheap but happy to be risky, business executives are looking for something safer but happier to spend more money.

How?

  • TDD using server.inject for testing
  • Host the project on heroku
  • Try to use basic ES6 syntax
  • Pair programming

Stretch Goals

  • Tailor users' results to their custom preferences
  • Display users' results in a more visually organised/ appealing way (hide irrelevant options)

Setup

  • To install npm dependencies:
npm install
  • To run the server:
npm run devStart
  • To run tests:
npm test
  • To check code coverage run:
npm run coverage

hapi-project's People

Contributors

cleop avatar rhodespeter avatar skibinska avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

cleop skibinska

hapi-project's Issues

Use of let vs const

Some variables declared using let make more sense as const. For instance, here:

if (!error && response.statusCode === 200) {
      let name = JSON.parse(body).results[0].name;
      let firstName = capitalise(name.first);
      let lastName = capitalise(name.last);
      return cb(null, `${firstName} ${lastName}`);
}

In this example, you are not reassigning any of those three variables, so may as well use const. It won't break your code to leave it as is, but would be better practice to change.

Directory for views?

You've defined some view files (index.html, results-page.html). It may be worth storing them in a directory called 'views', so in the server.views configuration you can set the path to 'public/views', just to keep things seperate

Parallel

https://github.com/a-la-node/hapi-project/blob/master/src/identity.js#L43

Nice solution to this problem with your parallel function :) is there a reason why you're calling your callback with undefined in the error spot instead of null as in other functions? Not a big deal as they're both falsy but might as well be consistent.

For future reference, promises would be the other way to solve this problem, maybe Bluebird.props if you wanted the results in a nice object:

function getIdentity(type){
  return Promise.props({
    newName: getNewName(),
    newPlace: getNewPlace(type)
  })
}

getIdentity('witness').then(console.log) // { newName: 'someName', newPlace: 'somePlace' }

Not sure if you're meant to be using promises yet though!

Formatting on line 34 in identity.js

return cb(null, randomCity.split('-').map(word => capitalise(word)).join(' '));

Perhaps join with a comma and a space, instead of just a space for formatting purposes.
So instead of this;
image
You'd get this;
image

... wait a minute, Ah.... that wouldn't work. hmmm...

Male or Female?

We need to create a user input field so we know weather to generate a male or female identity.

Get the Heroku hosting working

Heroku was working when the files were uploaded via git but not when directly from our Github. These are the error messages:

screen shot 2016-11-22 at 20 52 50

BEM naming styles

<div class="content overlay">
  <p> You are a...</p>
  <ul class="content--options">
    {{#each people}}
    {{{link this}}}
    {{/each}}
  </ul>
</div>

If content--options is dependent on content, it should be named content__options.

<div class="content overlay">
  <p> You are a...</p>
  <ul class="content__options">
    {{#each people}}
    {{{link this}}}
    {{/each}}
  </ul>
</div>

-- syntax is used for modifier rules, e.g. 'content__options--blue'.
See details about BEM naming conventions here

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.