Closed raniceyue closed 3 years ago
Hello,
Sorry for the late answer. It seems that the model.ts
is imported before the server.ts
. Is that possible?
You might not need to uses instances if you only have 1. So you could simply have a db.ts
file
// db.ts
const { Gstore, instances } = require('gstore-node');
const { Datastore } = require('@google-cloud/datastore');
const datastore = new Datastore({ projectId: 'my-project-id' });
const gstore = new Gstore();
gstore.connect(datastore);
module.exports = {
gstore,
};
And then import it in your model.ts
const { gstore } = require('./db');
const Schema = gstore.Schema;
...
Let me know if this works for you.
I will close the issue for inactivity. Feel free to re-open if the issue persists.
Hello, I am trying to use gstore-node to create an API for a web application.
Right now, in my
server.ts
, I have the following code to connect my gstore toand in my
model.ts
, I have the following code:Both my
model.ts
andserver.ts
are in the same directory, however whenever I run the server, I get the following error:I am not sure what I am missing here as I tried my best to follow the gstore-node documentation as much as possible, is there something I'm missing out?