kahmali / meteor-restivus

REST APIs for the Best of Us! - A Meteor 0.9+ package for building REST APIs https://atmospherejs.com/nimble/restivus
MIT License
544 stars 117 forks source link

URL params issue #314

Open niteesh1215 opened 1 year ago

niteesh1215 commented 1 year ago

main.ts

import { Restivus } from 'meteor/nimble:restivus';
const RestApi = new Restivus({
    apiPath: '/api/',
    prettyJson: true,
    enableCors: false
});

api1.ts

import {RestApi } from './main';
RestApi.addRoute(':company/subscription', { authRequired: false }, {
    get: function () {
            //code ..
        }
});

api2.ts

import {RestApi } from './main';
RestApi.addRoute(':subscription/event', { authRequired: false }, {
    post: function () {
            //code ..
        }
});

This is how the code is divided into 3 files. The issue is, When I invoke the endpoint :company/subscription the url param that I get is

{
   subscription: "value"
}

instead of

{
   company: "value"
}

But when I invoke the endpoint :subscription/event I get the correct url param i.e.

{
   subscription: "value"
}