# IPNS publish and resolve programmatically in node-js

**URL:** <https://discuss.ipfs.tech/t/ipns-publish-and-resolve-programmatically-in-node-js/7979>\
**Category:** Help\
**Tags:** js-ipfs, ipns\
**Created:** [May 13, 2020, 12:24am UTC](https://discuss.ipfs.tech/t/ipns-publish-and-resolve-programmatically-in-node-js/7979 "2020-05-13T00:24:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![RenaPero](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/renapero/32/6053_2.png) [@RenaPero](https://discuss.ipfs.tech/u/RenaPero)\
**Post date:** [May 13, 2020, 12:24am UTC](https://discuss.ipfs.tech/t/ipns-publish-and-resolve-programmatically-in-node-js/7979/1 "2020-05-13T00:24:07Z")

</div>

The docs of Name API have some [example code](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/NAME.md#namepubsubsubs) on how to resolve a cid from IPNS. I got the publish example code working fine but the resolve example code gives an error in the console: is not iterable.

```
// The IPNS address you want to resolve.
const addr = '/ipns/ipfs.io'

for await (const name of ipfs.name.resolve(addr)) {
  console.log(name)
  // /ipfs/QmQrX8hka2BtNHa8N8arAq16TCVx5qHcb46c5yPewRycLm
}

```

I inserted it in the [browser-mfs example](https://github.com/ipfs/js-ipfs/blob/master/examples/browser-mfs/index.js), at the bottom just after “updateTree(ipfs)”

Any tips or suggestions? 🙈 🙉 🙊
