You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> Remember that _top-level await_ stuff we mentioned earlier? There it is!
110
109
111
110
Note that we are getting our Redis URL from an environment variable. It was put there by Dotenv and read from our `.env` file. If we didn't have the `.env` file or have a `REDIS_URL` property in our `.env` file, this code would gladly read this value from the *actual* environment variables.
112
111
113
-
Also note that the `.open()` method conveniently returns `this`. This `this` (can I say *this* again? I just did!) lets us chain the instantiation of the client with the opening of the client. If this isn't to your liking, you could always write it like this:
114
-
115
-
{{< highlight javascript >}}
116
-
/* create and open the Redis OM Client */
117
-
const client = new Client()
118
-
await client.open(url)
119
-
{{< / highlight >}}
120
-
121
-
122
112
## Entity, Schema, and Repository
123
113
124
114
Now that we have a client that's connected to Redis, we need to start mapping some persons. To do that, we need to define an `Entity` and a `Schema`. Let's start by creating a file named `person.js` in the `om` folder and importing `client` from `client.js` and the `Entity` and `Schema` classes from Redis OM:
0 commit comments