Skip to content

pmc-muchiri/gallery

 
 

Repository files navigation

Darkroom — Image Gallery

Simple image gallery built with Express, EJS and MongoDB (Mongoose). Upload, view, update and delete images.

Website

Live demo: https://gallery-7io0.onrender.com/

  • Deployed on Render
  • Verify uptime before sharing(free version).

Features

  • Upload images (multer) and store file metadata in MongoDB.
  • View gallery and single image details.
  • Update image and delete images.
  • Basic test for the home route.

Quick start

  1. Install dependencies
npm install
  1. Environment
  • Copy .env.example to .env and set your MongoDB credentials (or use the included .env).
  • Connection URIs are built from env vars in ._config.js or server.js.

Key env vars used:

  • MONGO_USERNAME, MONGO_PASSWORD, MONGO_CLUSTER, MONGO_DB_DEV, MONGO_DB_TEST
  1. Run the app
node server.js
# or (dev)
node server.js
# or 
npm start 
  1. Run tests
npm test

Testing

Run tests locally:

npm install
npm test

Checkout the test branch (steps)

  1. If you don't have the upstream remote set, add it (only do this once):
git remote add upstream <UPSTREAM_REPO_URL >
  1. Fetch remote branches:
git fetch upstream
# or, if the branch is on origin: to chech this  do git remote -v
git fetch origin
  1. Create a local branch that tracks the remote test branch:
git checkout -b test upstream/test
  1. If the test branch already exists locally:
git checkout test
# update from upstream
git pull upstream test    
# or
git pull origin test
  1. Run the test the test branch:
npm test

Notes:

  • Replace <UPSTREAM_REPO_URL> with the repo URL(from the where you forked the repo).
  • Use git branch -a to list remote branches if you need to confirm the test branch name.
  • You can aswell use git remote -v to check the remote repository.

Important files

Deployment

  • App listens on process.env.PORT || 5000 in server.js.
  • Jenkinsfile included for CI/deploy examples.

Notes & tips

  • Uploaded images stored under public/images/ (ignored by Git).
  • Max upload size in routes/upload.js is 1MB — adjust limits.fileSize as needed.

Troubleshooting

  • Mongo connection errors: verify env values and network access to your cluster. See ._config.js and server.js.
  • Tests failing: ensure test DB is reachable or mock DB for CI. Test uses test/serverTest.js.

License

ISC

Author

Forked from

This project was forked from jonnygovish/gallery.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 48.5%
  • EJS 46.4%
  • CSS 5.0%
  • Procfile 0.1%