Skip to content

Gforth basic webserver with Gforth scriping as the main feature! This is Gforth not F#. Github currently reports this incorrectly.

License

Notifications You must be signed in to change notification settings

harrypower/gforth_webserver

Repository files navigation

httpd.fs 
string.fs
proxy.fs
sockets.fs

These files are from the gforth 0.7.0 distributed files. They work together to make a basic webserver. 
These files can be found at /usr/share/gforth/0.7.0 if you have installed gforth via $ apt-get install gforth
The httpd.fs was writen by Bernd Paysan so the credit goes to him for all the work here!
The other files i am unsure of who the authors are but Bernd may be also responsible for them.
I have not tested the proxy stuff yet or set it up to be used yet.  
This code needs the inetd service running and this can be installed with $ apt-get install inetutils-inetd

I have made this repository for the purpose of enabling other Raspberry Pi users to learn and use forth as another programming lanugauge.  This repository is used on a raspberry pi with debian wheezy distro running!

To use this server you need to install Gforth, inetd and then configure this service and adjust the path for the web files. The steps are below( do this on the pi or via sshing into the pi)
-Install stuff
    $ sudo apt-get install gforth
    $ sudo apt-get install inetutils-inetd
-Install dependent Rpi_Gforth_GPIO library submodule ( the raspberry pi gpio stuff depends on this library !)
	Note that this Rpi_Gforth_GPIO is a submodule in this repository.  This means you must issue these four commands from this gforth_webserver repositorys directory to get the files:
		$ sudo git submodule init
		$ sudo git submodule update
		$ cd gpio
		$ sudo git checkout master
	Now follow the README in the gpio directory for information on compiling the C code into a shared library.
	Run gforth as in the README in the gpio directory and enter the following as show in that README:
		include rpi_GPIO_lib.fs
	There should be no message if all is working.  Note if you need to recompile the library just follow the README file for how to remove the old and recompile the new library.  Then use ./clean command to remove the gforth library and then do the above include rpi_GPIO_lib.fs from gforth command line to reconnect the c library to gforth.  
-Install dependant Chart.js library submodule ( this is only needed if you want to see the chart test or work with it in any way!)
	Do the following to install it from the gforth_webserver directory:
		$ sudo git submodule init
		$ sudo git submodule update
		$ cd /htdocs/chart
		$ sudo git checkout master
	Nothing else is needed to be done for this submodule.  
	Note there are example html files in this submodule directory for example usage of the chart.js library.
-Adjust the path for your web content as follows:
    $ sudo nano httpd.fs
	Find the following line in the code:
	Variable DocumentRoot  s" /home/pi/git/gforth_webserver/htdocs/" DocumentRoot $!
	Change the /home/pi/git/gforth_webserver/htdocs/ to match where the index.html and other web docs are.
	Save the file with control x, y enter.
-Configure inetd service and start the webserver as follows:
    $ sudo nano /etc/inetd.conf
	Move the curser to the end of the document and enter the following text:
	gforth stream tcp nowait.100 root /home/pi/git/gforth_webserver/httpd.fs
	( Note if you want this to work on port 80 then replace gforth with http in above line. )
	Save the file with control x y enter
	$ sudo nano /etc/services 
	Move to the bottom of the document and add the following line:
	gforth	4444/tcp
	Save the file with control x y enter
	Now at this moment you can restart your pi as follows:
	$ sudo shutdown "now" -r
When the pi starts up it will serve your index.html and other web stuff on port 4444 or 80 if you did the http change in the note above!
	
	

About

Gforth basic webserver with Gforth scriping as the main feature! This is Gforth not F#. Github currently reports this incorrectly.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published