This example shows how to install biicode and code a node.js redis client. You don't need to have installed redis, biicode will download for you, it is already in biicode!
1. Installing biicode and node.js
First download and install biicode
Then, download and install on your system the appropriate version of Node.js .
2. Create your project
First, create a project:
~$ bii init myproject
Then we can use the convenience
new command to create some folders and a "Hello World" Node.js main file. Of course, you can do it manually too.
~$ cd myproject ~/myproject$ bii new myuser/myblock --hello=node
myuser, there's no need to register an account to use biicode, only to upload and share contents. You can use other name too. If you have already registered you might want to replace
myuserwith your real biicode username.
This should be the resulting layout:
+-- myproject | +-- bii | +-- blocks | | +-- myuser | | | +-- myblock | | | | +-- main.js | +-- deps
3. Run your program
Lets check that everything is fine by running the hello world aplication.
~/myproject/$ cd blocks ~/myproject/blocks$ noderunner myuser/myblock/main.js
4. Depending on redis
Copy the following code containing a simple redis client into the main.js file:
~/myproject$ bii find
Run a redis server. If you need to install redis, you can download it from redis.io.
~/myproject$ redis server
Now, execute your script main.js.
~/myproject/$ cd blocks ~/myproject/blocks$ noderunner myuser/myblock/main.js Reply: OK Exiting from quit command.
That's it, if you see that output redis was downloaded and configured in your project!
You can check the
deps folder, the redis code is there.
Didn't work? No problem, read or contact us in the biicode forum
Any suggestion or feedback? Write us! It is very welcomed :)