Overloading functions for an api in node - Best practice?

I'm currently building a small express powered node app to power a RESTful API exposing data from a node module I wrote. One of the functions in the module takes three arguments, but I want to allow the usage of the API by specifying just one, two, the other two or all three arguments.

So even starting to write the routes like this already feels ridiculous.

app.get('/api/monitor/:stop/:numresults', apiController.monitorNum);
app.get('/api/monitor/:stop/:timeoffset', apiController.monitorOff);
app.get('/api/monitor/:stop', apiController.monitor);

Especially since I don't know how to specify the difference between the first two, as numresults and timeoffset are both just integers.

What would a best practice in this situation look like?

The first problem you face is that you have identical routes, which are not possible if you're using express (I'm assuming that's what you're using). Instead you probably want one route and utilise the query object instead:

app.get('/api/monitor/:stop/', function (req, res, next) {
    var stop = req.params.stop,
        numResults = req.query.numResults,
        timeOffset = req.query.timeOffset;

    yourFunc(stop, numResults, timeOffset);
});

That way you can call the api with the following url: http://example.com/api/monitor/somethingAboutStop/?numResults=1&timeOffset=2. It looks like the stop parameter can also be moved to the query object but it's up to you.

You can use a catchall route then parse it yourself.

Example:

app.get('/api/monitor/*', apiController.monitor);

Then in apiController.monitor you can parse the url further:

exports.monitor = function(req, res) {

    var parts = req.url.split('/');
    console.log(parts);        // [ '', 'api', 'monitor', '32', 'time' ]
    console.log(parts.length); // 5

    res.end();
};

So, hit the /api/monitor/32/time, and you get that array above. Hit it with /api/monitor/something/very/long/which/you/can/parse and you can see where each of your params go.

Or you can help yourself, like /api/monitor/page/32/offset/24/maxresults/14/limit/11/filter/by-user

Though, as Deif has told you already, you usually do pagination with query parameters, maxResults & page being your usual params.