SAFE NODEJS API documentation (preliminary)

I built the docs for safe_app_nodejs and so I can get them from any device I uploaded them.

So anyone can access them here:

https://managedwebsitehosting.net/safeapi/

I don’t promise to keep these up to date, but as I don’t see them in today’s update thought this might be useful to others too.

EDIT: To clarify, these are the official docs (not my work), but published unofficially.

Anyone can build them in the safe_app_nodejs repo (I even had to ask Ben how :blush:). I didn’t mean to give the impression I did significant work here!

So to make your own local copy:

npm run docs

Creates them in ./docs

14 Likes

Just an FYI, safe_app_nodejs is not really ready to be consumed as an npm module (it won’t build on install, or download the right binaries from anywhere). Eventually the plan is for the postinstall script to download the right binaries and put them in the native client directory. I have a fork of the project which builds on install, so you can point your package.json there for now.

fork: https://github.com/ethanpailes/safe_app_nodejs/

These docs are great BTW. Thanks for posting them.

3 Likes

Thanks @ethanpailes :slight_smile:

BTW these aren’t my work but @ben’s I assume. Sorry for wrong impression (have edited the OP to clarify).

PS I cloned this today and it did seem to build and create native binaries. That’s all I did though, plus build the docs. For anyone else: you’ll need Rustc beta (1.16) and up to date npm and nodejs (6.x).

Oh I know that you are just hosting them. I was thanking you for that. Sorry if it sounded like I was miss-allocating credit.

1 Like

Thank you for the information. I try to look through the documentation, but as a newbie to javascript, not sure how to start with it. Hopefully, there will be more guidance on the document.

Yes, Peter this is very raw, just one step away from looking at the code itself.

MaidSafe will be providing updated tutorials showing how to use this. Another good way to explore is to look at the code in example apps.

These are still being built, but the there is example (in the safe_app_nodejs repo) to search for how they use different parts of the API, though I haven’t looked at it myself yet.

1 Like

I tried building your fork but failed towards the end with error message: "cp: cannot stat ‘native/target/debug/safe_app’: No such file or directory’.

Looking around after the build, I see there is no such path “'native/target/debug”, but I do see: “target/debug/native”. It’s empty unfortunately.

I’d really love to get this going. Any thoughts how to fix it?

@tmark, the repo includes git submodules. Did you do git submodule update --init --recursive after you cloned it? The native subdirectory is a git submodule which points to the old safe_core library (though it has a new name now for some reason).

Also make sure you are running rust-1.14.0 (not 1.15.{0,1}! Rust 15 has a cargo workspace bug), and the latest stable version of node (though that should not have an impact on the build, its just that the repo contains ES6 code).

Let me know if that still does not fix things.

1 Like

Reverting back to rust version 1.14.0 resolved my build issue, thanks!

I just updated the fork to include the latest patches from upstream, including one which adds some documentation about the right rust version. Hopefully this will help prevent other people from running into the same issue.

1 Like

How do I build the docs?

npm run docs

Creates them in ./docs

1 Like