Experimenting with Node to create a streamlined server that can upload and display photos
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
client/html
scripts
server
.gitignore
Gruntfile
README.md
package.json

README.md

NodePhotoServer

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.

Dependencies

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
  • imagemagick

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

Ubuntu Instructions

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.