I'm building this project with the intent on learning node.js. The goal is to create a HTTP-based node server that can accepts photos and messages and stream the content to users.
Below are the only dependencies needed to build the server. It currently has been tested on both Linux and Mac. At this point, I'm not sure what it would take to get things working with Windows. If I were to guess, I would think using cygwin would be your best bet.
- node.js v10.x
- gcc >= v4.2
Installing Node for Mac
The easiest way is to first install homebrew and then execute the following commands in a Terminal window:
brew update brew install node || brew upgrade node brew install imagemagick || brew upgrade imagemagick
You must add a new repository to access the 10.x version of nodejs.
echo 'Yes' | sudo apt-add-repository ppa:chris-lea/node.js sudo apt-get update -y sudo apt-get install -y nodejs imagemagick sqlite
The server is also dependent on the following node modules (npm handles the install):
- sqlite - the current persitance layer
- formidable - used for parsing form data
- imagemagick - for creating thumbnails
- socket.io - used in gallery to push photo updates to listening clients
Running the server
After ensuring all dependencies are met, execute the following commands started from the base directory of this cloned git repository.
cd server/ npm install cd ../scripts/ ./genDB ./startServer
The "genDB" script sets up the SQLite database and the "startServer" script creates the images folder if needed and executes "node index.js" to start the node server. After running the above commands, you should see a message that states "Server has started ...". From there, open your favorate browser or mobile phone to http://localhost:8080. Note, to access it on a phone, you must substitute localhost with the IP address of the internal machine that is running your node instance.