Code Monkey home page Code Monkey logo

koa-modern-router's Issues

`allowedMethods` throws TypeError exception when configured akin to the docs

❗Issue was user error❗

SEE: #3 (comment)

Is this a feature request or a bug?

Bug.

Expected behavior:

Handle configuration exception at instantiation (if that's what this is) or gracefully handle error such that a useful error message is displayed. Otherwise, I would expect this not throw.

Actual behavior:

When Configuring the router to use allowedMethods, i.e.

router.allowedMethods({
  notImplemented: () => new Boom.notImplemented()
});

Upon request (in my case it was an OPTIONS request) an exception was thrown:

TypeError: Cannot read property 'forEach' of undefined
      at node_modules/koa-modern-router/lib/router.js:440:21

Environment info (relevant browser, OS, etc.; run npx envinfo):

System:

  • OS: macOS 10.14.4
  • CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
  • Memory: 782.68 MB / 16.00 GB
  • Shell: 5.7.1 - /usr/local/bin/zsh

Binaries:

  • Node: 10.15.3 - ~/.nvm/versions/node/v10.15.3/bin/node
  • Yarn: 1.15.2 - ~/.nvm/versions/node/v10.15.3/bin/yarn
  • npm: 6.9.0 - ~/.nvm/versions/node/v10.15.3/bin/npm

Utilities:

  • Make: 3.81 - /usr/bin/make
  • GCC: 10.14. - /usr/bin/gcc
  • Git: 2.20.1 - /usr/bin/git

Virtualization:

  • Docker: 18.09.2 - /usr/local/bin/docker
  • Parallels: 14.1.3 - /usr/local/bin/prlctl

IDEs:

  • Emacs: 22.1.1 - /usr/bin/emacs
  • Nano: 2.0.6 - /usr/bin/nano
  • Sublime Text: Build 3207
  • Vim: 8.0 - /usr/bin/vim
  • Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild

Languages:

  • Bash: 5.0.7 - /usr/local/bin/bash
  • Java: 12.0.1 - /usr/bin/javac
  • Perl: 5.18.2 - /usr/bin/perl
  • PHP: 7.1.23 - /usr/bin/php
  • Python: 2.7.16 - /usr/local/bin/python
  • Ruby: 2.3.7 - /usr/bin/ruby
  • Rust: 1.18.2 - ~/.cargo/bin/rustup

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.