Code Monkey home page Code Monkey logo

spirit-router's People

Contributors

hnry avatar kenny1har 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  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

spirit-router's Issues

Bug in route detection for get endpoints with querystring

It appears that at present the route matcher detects query strings as a component of the URL path. This requires the query parameter to be explicitly stated in the route like so:

Route.get("/environment?host=:host", ["query"], GET_Environment)

whereas it should be:

Route.get("/environment", ["query"], GET_Environment)

Any thoughts?

HTTP Statuscodes

It would maybe nice if the router raises correct HTTP errors instead of just returning undefined.

In my case I would like to distinguish between "Not Found" (404) and "Method Not Allowed" (405), in case that the route exists but just with an other method.


Currently I'm fetching the undefined and raise a "Not Found" error. (not perfect solution)

How treat promise error

Hey @hnry, I have another question for you.

When I try to create a user with an used email I want to response the status code 422 with the message below:

{
  "message": "Email already registered"
}

This is my route:

const register = ({ name, email, password }) =>
  new User({ name, email, password: hashSync(password) })
    .save() // Promise

How can I do that?

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.