A simple application server with node and Raspberry Pi
This open source software offered by Google and available on GitHub greatly facilitates the creation of a local or Internet server. It is described by the authors as "An easy way to make web stuff on Raspberry Pi."
Google Coder is a version of Raspbian on which node is preinstalled with a server script and a web interface for the client.
To install it and create your application server, here is what you need:
- A Raspberry Pi Model B to have a network connector. The Pi Zero can also be used with an Ethernet expansion card.
- An image of the OS: the raspi.img file obtained after downloading and extracting the coder.zip file, from the website (link at bottom).
- An SD or micro SD card according to the Pi model. You must format it to FAT32. If your system does not allow to do so, this may be achieved with SD Formatter.
- You must then burn the image to the SD. The same software used to Raspbian and indicated on the Raspberry site can be used here: Win32DiskImager for Windows, available at Sourceforge. For other systems, see on the Raspberry website for the installation guide.
For electronic assemblies, an interface to the hardware is also required, you may use for example:
- Raspi-io. Plugin to adapt Johnny-Five to the Pi.
Once created the SD card, simply insert it into the Pi, connected to the Internet and power it on. Your client computer must be connected to the Internet too.
A prompt to a login and password will be displayed. But it is not necessary to log on the server to make it accessible to clients. If, however, you can to log to the server, enter pi as login and then the password that you give from the client interface.
Whatever your system is Windows, Linux, MacOs or Android, you can directly connect to Pi.
On your computer, if the system is Linux ou MacOS, type in the URL field of the browser:
On Windows, enter instead the IP address which is displayed on the server just before the login prompt (the IP depends on your hardware).
Put this URL in bookmarks and you will never need to search the IP again! You could also enter the IP on Linux or Mac. And also associate a domain to this IP with a DNS service.
A warning message should appear indicating that the site is not secure and invites you to leave it quickly. This is expected and Google asks you to ignore the warning. Click the link at the bottom of the page to continue on the site.
You now have access to an interface that is a Web page sent by the Pi, whether in the same room or anywhere in the world. This interface allows you to choose an application, or add your own application.
Accessing the server
When the client interface appears, you are asked to create a password to login. This password is also used to access the server on the Pi. Accessing the server is not required to complete an application, but to add programs and modules.
If the keyboard is of AZERTY type, it is best to choose letters that have the same position on the QWERTY keyboard because it is the latter that recognizes the Pi. Avoid the letters A and M. You should also print a image of a QWERTY keyboard to see the correspondence.
So you enter the server-side system by typing pi for your customer login and password. But then you must immediately configure the system to your language and your keyboard. Type sudo raspi-config, or more precisely on AZERTY keyboard rqspi)config to access the configuration program. Then go to the line of internationalization and choose your language and keyboard, and make the successive steps. You must reboot the system for the changes to take effect.
The interface is a group of colorful tiles, each corresponding to an application. In fact it takes up the idea of Tiloid, with online access added. Tiloid uses Node on the backend and is a free alternative to the Modern UI of Windows 8. Coder further enhances this idea. This is inter alia the equivalent for Raspberry to the Arduino IDE.
You click a tile to launch an application, or the green tile with the "+" sign to add a new application. Its code is distributed over several tabs as shown in the screenshots below:
Server-side code: you can send images to the server through the Media Interface
Your application is thus made entirely remotely and stored on the server by Coder. By removing completely the server-side access to the programmer, Coder makes the simplest possible installation. An application can thus be made on a desktop computer and be used on a mobile for home management or aid to productivity. Even robotics use is possible since you can develop server side code with the Node tab. No need to do sumo with sudo and all those endless commands.
Ressources et informations
- Coder. Official website of the project. Where to get all the infos.
- Source code on GitHub.
- How to add an app. Several examples are given.