GithubHelp home page GithubHelp logo

mtharrison / hapi.js-in-action Goto Github PK

View Code? Open in Web Editor NEW
172.0 14.0 61.0 558 KB

Code package for hapi.js in Action by Matt Harrison (Manning Publications)

JavaScript 80.13% HTML 13.13% CSS 6.69% Shell 0.05%

hapi.js-in-action's Issues

Cannot Access the db in handlers?

Here is the dbConneciton:

const Sqlite3 = require('sqlite3');

const db = new Sqlite3.Database('./dindin.sqlite');

I had use bind the db with server.bind({ db: dbConnection }) but i dont know why i cannot access the this.db in handlers. According to book [Hapi Js in Action] and server.bind it should be working. I had to use server.app.db = dbConnection and every handler i had to do something like const db = request.server.app.db and works fine.. is there issue with server.bind in hapi js version 13.4.0 and I m loving ur book....

Hapi v17

Hey Matt,

I'm stoked to watch you're latest videos for Hapi! I was wondering if you intend to update this project to Hapi 17, or if you would have any interest in doing so? I am new to Hapi, so I was thinking it might be an interesting way to learn Hapi and contribute back with a PR to update some sections.

Q: Why use typeof

Hi, firstly I'd like to thank you for writing a great book. I purchased it yesterday and already found it very helpful.

One question I have concerns the way you validate whether /api/get/{id} returns an actual result from the database:

if (typeof result !== 'undefined') {
    return reply(result);
}

Why not take advantage of the type coercion and simply:

if (result) {
    return reply(result);
}

Does typeof cover some exceptional cases I do not foresee?

Thank you very much!

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.