narrow-doctor-83397
04/23/2024, 11:49 AMconst data = req.growthbook.getFeatures();
Whenever I am creating a new feature in “Sample Data” project, I am able to get the feature, but not when I’m creating it in a new project.
Is there any way I can define the project while initialising the GrowthBook object?
This is how I’m initialising.
app.use(function (req, res, next) {
req.growthbook = new GrowthBook({
apiHost: "<http://localhost:3100>",
clientKey: "hidden",
enableDevMode: true,
subscribeToChanges: true,
});
res.on("close", () => req.growthbook.destroy());
req.growthbook
.loadFeatures( { timeout: 1000 } )
.then(() => next())
.catch((e) => {
console.error("Failed to load features from GrowthBook", e);
next();
});
});
narrow-doctor-83397
04/23/2024, 12:03 PMfresh-football-47124