Hello

Im trying to create REST api for my simple web page. My code is looking like below:

module service.frontpage;

import vibe.d;

@path("/api")
interface IFrontPageAPI
{
  Json getHome();
}

class FrontPageAPI : IFrontPageAPI
{


  this(auto tmp)
  {
    auto collect = tmp;
  }

  Json getHome()
  {
    logInfo("Getting HomePage from DB");
    Bson query = Bson(["_id" : Bson("homepage")]);
    auto result = collect.find(query);


    logInfo("Iterating results...");
    foreach (i, doc; result.byPair)
    logInfo("Item %d: %s", i, doc.toJson().toString());

    return result.toJson();
  }
}

But when i try to compile it im getting:

source/service/frontpage.d(15,3): Error: undefined identifier 'tmp', did you mean alias 'cmp'?

Did i miss something?

Reply via email to