Giter Site home page Giter Site logo

awilix-router-core's People

Contributors

jeffijoe avatar whefter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

awilix-router-core's Issues

Validating a controller's methods

As I'm temporarily using plain NodeJS to migrate old code to awilix before moving to Typescript based code, I was wondering if it is possible to implement a startup validation for this module? Currently running into continuous methods which are missing, which Im trying to fix with unit and end-to-end testing (quite a slow method).

Startup validation would basically require looping over and checking whether the controller method or class has the functions indicated in the builder pattern and throwing an error when its missing. Does this sound doable to you? If not, its no problem to close the issue.

Breaks if node runs with "--experimental-modules"

Hey,

thanks for this nice library!
Unfortunately this does not run out-of-the box (a.k.a. without babel) with Node and the "experimental modules" feature switched on.
It breaks on the following line - where you require a module instead of importing it.

let required = require(path)

When I switch the whole project to esm with this line in package.json:

"type": "module",

Then everything works... except the line I mentioned above.

But changing that line to

import(path).then(required => { ... }

Seems to work.
But since this router should be able to run in both worlds - modules and commonjs - there need to be some tuning here and there.

Do you have any experience with this?

Strange partial match behaviour if you break the undocumented uniqueness constraint

const filteredEntries = Array.from(state.methods.entries()).filter(

These lines of code replace a route if the target endpoint name is a duplicate.

The route then takes on some very strange characteristics.
In my example:

GET /:id endpointFn
POST /:id/query endpointFn

Using middleware to coerce the payload from body to query so the same endpoint can handle body and provide a way around the maximum URL length.
I stumbled onto this requirement when POST /:id wasn't behaving as expected for someone and I told them this is not even a route and should return 404.
It was not..

I have not dug further into the WHY of the code beyond this point as I have simply re-written my code to go around the issue.
But, the replacement appears to introduce partial route matching such that invalid routes are no longer falling through to 404.

I would suggest 2 things:
Firstly, document this restriction in the readme as this library enforces a restriction that it is not making clear to the consumer (for me that is via awilix-express)
Secondly, investigate why partial route-matching is caused by the replacement or undo the decision to replace.

Once I removed the duplicate endpoint in the builder configuration the POST /:id call returned 404 as I would have expected.

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid npm token.

The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

If you are using Two-Factor Authentication, make configure the auth-only level is supported. semantic-release cannot publish with the default auth-and-writes level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

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.