{"id":21307263,"url":"https://github.com/jdegand/my-unsplash-backend","last_synced_at":"2026-04-16T11:31:13.254Z","repository":{"id":110668752,"uuid":"520203288","full_name":"jdegand/my-unsplash-backend","owner":"jdegand","description":"Devchallenges - Legacy - Full-Stack Developer - My Unsplash","archived":false,"fork":false,"pushed_at":"2024-10-07T02:16:19.000Z","size":40,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-15T19:48:51.160Z","etag":null,"topics":["devchallenges","devchallenges-legacy","express","mongoose"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jdegand.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-01T17:29:49.000Z","updated_at":"2024-10-07T02:16:22.000Z","dependencies_parsed_at":"2024-11-21T16:37:01.201Z","dependency_job_id":"5f74551c-55cb-43ec-a2c0-5a276f11a17c","html_url":"https://github.com/jdegand/my-unsplash-backend","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jdegand/my-unsplash-backend","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdegand%2Fmy-unsplash-backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdegand%2Fmy-unsplash-backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdegand%2Fmy-unsplash-backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdegand%2Fmy-unsplash-backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jdegand","download_url":"https://codeload.github.com/jdegand/my-unsplash-backend/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdegand%2Fmy-unsplash-backend/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31883695,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T09:23:21.276Z","status":"ssl_error","status_checked_at":"2026-04-16T09:23:15.028Z","response_time":69,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["devchallenges","devchallenges-legacy","express","mongoose"],"created_at":"2024-11-21T16:30:53.107Z","updated_at":"2026-04-16T11:31:13.229Z","avatar_url":"https://github.com/jdegand.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eMy Unsplash Backend\u003c/h1\u003e\n\n\u003cdiv align=\"center\"\u003e\n   Solution for a challenge from  \u003ca href=\"https://web.archive.org/web/20231130035602/https://legacy.devchallenges.io/challenges/rYyhwJAxMfES5jNQ9YsP\" target=\"_blank\"\u003eDevchallenges.io\u003c/a\u003e.\n\u003c/div\u003e\n\n## Table of Contents\n\n- [Overview](#overview)\n  - [Built With](#built-with)\n- [Features](#features)\n- [Thoughts](#thoughts)\n- [How to use](#how-to-use)\n- [Useful Resources](#useful-resources)\n\n## Overview\n\n### Built With\n\n- bcrypt\n- cookie-parser\n- cors\n- express    \n- mongoose\n- jsonwebtoken\n\n## Features\n\nThis application/site was created as a submission to a [DevChallenges](https://devchallenges.io/challenges) challenge. The [challenge](https://web.archive.org/web/20231130035602/https://legacy.devchallenges.io/challenges/rYyhwJAxMfES5jNQ9YsP) was to build an application to complete the given user stories. **Note**: The previous design document may be incomplete, as you need to find an archived version of the challenge as all `legacy` challenges have had their documentation removed from DevChallenges.\n\n## Thoughts\n\n- Thought about using passport and react - I think passport pairs better with template languages.\n- Could have used a roles based implementation where deleting a photo required a certain role.\n- Didn't make deleting a photo password-based since you have to be logged-in already. \n- Commenting out the Image Model `unique: true` is not enough - you need to login to mongo atlas and disable it there as well\n- Could make a images route and that gets all users images - code commented out in Image controller\n- If refresh token expires in non-persist mode and you are logged in, adding an image will not work but you won't see a message or any feedback (console log only)\n- Could add users route for an admin\n- Having a view for the api seems unnecessary so I commented that out.  Could make a documentation index page on index route. \n- I didn't add properties to the request object - I associate that pattern with session-based authentication. Added them to the jwt instead.  I think you can use jwt and sessions together - but I didn't try that here.  \n\n## How To Use\n\nTo clone and run this application, you'll need [Git](https://git-scm.com) and [Node.js](https://nodejs.org/en/download/) (which comes with [npm](http://npmjs.com)) installed on your computer. From your command line:\n\n```bash\n# Clone this repository\n$ git clone https://github.com/jdegand/my-unsplash-backend.git\n\n# Install dependencies\n$ npm install\n\n# Add MONGO_URI, SESSION_SECRET, ACCESS_TOKEN_SECRET, and REFRESH_TOKEN_SECRET env variables\n\n# Run the app\n$ npm start\n```\n\n## Useful Resources\n\n- [Steps to replicate a design with only HTML and CSS](https://devchallenges-blogs.web.app/how-to-replicate-design/)\n- [djamware](https://www.djamware.com/post/58eba06380aca72673af8500/node-express-mongoose-and-passportjs-rest-api-authentication) - passport authentication\n- [Auth0 Blog](https://auth0.com/blog/create-a-simple-and-secure-node-express-app/) - simple express app with passport-auth0\n- [Stack Overflow](https://stackoverflow.com/questions/28352871/in-express-how-do-i-redirect-a-user-to-an-external-url) - express redirects\n- [Mastering JS](https://masteringjs.io/tutorials/express/redirect) - express redirect\n- [Coding Deft](https://www.codingdeft.com/posts/react-authentication-mern-node-passport-express-mongo/#creating-local-strategy) - passport local strategy\n- [YouTube](https://www.youtube.com/watch?v=IUPHbf9cw74) - Curly Braces - Social Media App with passport\n- [BezKoder](https://www.bezkoder.com/node-express-mongodb-crud-rest-api/#Demo) - express mongodb crud rest api\n- [Blog](https://levelup.gitconnected.com/a-guide-to-authentication-using-passport-local-in-react-f5b3db06d4d0) - passport local with react\n- [Medium](https://medium.com/@brendt_bly/simple-mern-passport-app-tutorial-4aec2105e367) - mern passport\n- [Stack Overflow](https://stackoverflow.com/questions/62461748/react-express-with-passport-js) - react express with passport\n- [Mastering JS](https://masteringjs.io/tutorials/mongoose/create) - mongoose create()\n- [YouTube](https://www.youtube.com/watch?v=cu6VQgT3EEI) - mongoose\n- [TopCoder](https://www.topcoder.com/thrive/articles/authentication-and-authorization-in-express-js-api-using-jwt) - authentication and authorization with jwt\n- [Stack Overflow](https://stackoverflow.com/questions/3521290/logout-get-or-post) - logout get or post\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjdegand%2Fmy-unsplash-backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjdegand%2Fmy-unsplash-backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjdegand%2Fmy-unsplash-backend/lists"}