{"id":28974839,"url":"https://github.com/plcoster/fcc_infosec_project1","last_synced_at":"2026-04-25T08:38:15.326Z","repository":{"id":299016102,"uuid":"537644047","full_name":"PLCoster/fcc_infosec_project1","owner":"PLCoster","description":"FreeCodeCamp Information Security Project 1: Stock Price Checker","archived":false,"fork":false,"pushed_at":"2022-09-19T22:22:14.000Z","size":143,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-14T06:32:58.292Z","etag":null,"topics":["express","mocha-chai"],"latest_commit_sha":null,"homepage":"https://fcc-infosec-project1.plcoster.repl.co/","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/PLCoster.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,"zenodo":null}},"created_at":"2022-09-16T23:08:29.000Z","updated_at":"2022-09-16T23:13:31.000Z","dependencies_parsed_at":"2025-06-14T06:33:02.003Z","dependency_job_id":"64d5d7aa-2d07-4ba5-a72b-6f510be54d0b","html_url":"https://github.com/PLCoster/fcc_infosec_project1","commit_stats":null,"previous_names":["plcoster/fcc_infosec_project1"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/PLCoster/fcc_infosec_project1","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PLCoster%2Ffcc_infosec_project1","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PLCoster%2Ffcc_infosec_project1/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PLCoster%2Ffcc_infosec_project1/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PLCoster%2Ffcc_infosec_project1/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PLCoster","download_url":"https://codeload.github.com/PLCoster/fcc_infosec_project1/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PLCoster%2Ffcc_infosec_project1/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261669008,"owners_count":23192362,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["express","mocha-chai"],"created_at":"2025-06-24T12:07:08.276Z","updated_at":"2026-04-25T08:38:15.254Z","avatar_url":"https://github.com/PLCoster.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Free Code Camp: Information Security Project 1 - Stock Price Checker\n\n## Stock Price Checker\n\nThe aim of this project was to build a small web app with functionality similar to: https://stock-price-checker.freecodecamp.rocks\n\nThe project was built using the following technologies:\n\n- **HTML**\n- **JavaScript** with **[Node.js](https://nodejs.org/en/) / [NPM](https://www.npmjs.com/)** for package management.\n- **[Express](https://expressjs.com/)** web framework to build the web API.\n- **[mongoose](https://mongoosejs.com/)** for MongoDB object modeling, interacting with a **[MongoDB Atlas](https://www.mongodb.com/atlas/database)** database.\n- **[Helmet](https://helmetjs.github.io/)** for Express.js security with HTTP headers.\n- **[bcrypt](https://www.npmjs.com/package/bcryptjs)** for hashing user IP addresses for anonymity.\n- **[Bootstrap](https://getbootstrap.com/)** for styling with some custom **CSS**.\n- **[FontAwesome](https://fontawesome.com/)** for icons.\n- **[Mocha](https://mochajs.org/)** test framework with **[Chai](https://www.chaijs.com/)** assertions for testing.\n- **[nodemon](https://nodemon.io/)** for automatic restarting of server during development.\n\nLive stock prices are provided by the Free Code Camp Stock Price Checker Proxy: https://stock-price-checker-proxy.freecodecamp.rocks\n\n### Project Requirements:\n\n- **User Story #1:** The content security policy should be set to only allow loading of scripts and CSS from your server (via `helmet`).\n\n- **User Story #2:** You can send a `GET` request to `/api/stock-prices`, passing a NASDAQ stock symbol to a stock query parameter. The returned object will contain a property named `stockData`.\n\n- **User Story #3:** The `stockData` property includes the `stock` symbol as a string, the `price` as a number, and `likes` as a number.\n\n- **User Story #4:** You can also optionally pass include a `like` query parameter with a value of `true` to have your like added to the stock(s). Only 1 like per IP should be accepted.\n\n- **User Story #5:** If you pass along 2 stocks with the `GET` request to `/api/stock-prices`, the returned value will be an array with information about both stocks. As well as `likes`, it will display `rel_likes` (the difference between the likes on both stocks) for both `stockData` objects.\n\n- **User Story #6:** The 5 following functional tests for the `GET /api/stock-prices` route are complete and passing:\n  - Viewing one stock: GET request to `/api/stock-prices/`\n  - Viewing one stock and liking it: GET request to `/api/stock-prices/`\n  - Viewing the same stock and liking it again: GET request to `/api/stock-prices/`\n  - Viewing two stocks: GET request to `/api/stock-prices/`\n  - Viewing two stocks and liking them: GET request to `/api/stock-prices/`\n\n### Project Writeup:\n\nThe first Free Code Camp: Information Security Project is a simple Stock Price Checking App and API. Users can view current price information for a single selected stock or compare two stocks. In addition, users can 'like' selected stocks. Likes are limited to one like for each stock per unique IP address. IP address are anonymised by hashing using `bcrypt` before being stored in a MongoDB database. The following actions are possible:\n\n- View a single stock price and number of likes from users by submitting the relevant form on the App homepage, or by sending a GET request to `/api/stock-prices?stock=\u003cSYMBOL\u003e` where `\u003cSYMBOL\u003e` is the symbol of the desired stock (e.g. `GOOG`). An optional `like` query parameter with a value of `true` can also be added to add a 'like' to the selected stock.\n\n- View a comparison of two stocks by submitting the relevant form on the App homepage, or by sending a GET request to `/api/stock-prices?stock=\u003cSYMBOL1\u003e\u0026stock=\u003cSYMBOL2\u003e`, where `\u003cSYMBOLX\u003e` are the symbols of the desired stocks. An optional `like` query parameter with a value of `true` can also be added to add a 'like' both of the selected stocks.\n\nA test suite has been written for the app:\n\n- `tests/2_functional-tests.js` contains functional tests of the application routes (GET requests to `/api/stock-prices`).\n\n### Project Files:\n\n- `server.js` - the main entry point of the application, an express web server handling the routes defined in the specification.\n\n- `/routes/api.js` - contains the major API routes for the express web app.\n\n- `/controllers` - contains the `stocklikescontroller.js` middleware, with methods to get stock price information, and add likes for requested stocks if desired.\n\n- `/models` - contains `mongoose` database schema for the application. The `StockLikes` schema represents a specific user (identified by a hash of their IP address) liking a specific stock (identified by the stock symbol).\n\n- `public/` - contains static files for the web app (stylesheet, logo, favicons etc), served by express using `express.static()`.\n\n  - `script.js` contains a JS script for handling front-end form submission and UI updates with responses, and is loaded by `index.html`.\n\n- `views/` - contains the single html page for the web app, `index.html`, which is served by express on `GET` requests to `/`\n\n- `tests/` - contains the test suite for the application.\n\n### Usage:\n\nRequires Node.js / NPM in order to install required packages. After downloading the repo, install required dependencies with:\n\n`npm install`\n\nTo run the app locally, valid production and testing MongoDB database URIs are required to be entered as environmental variables (`MONGO_URI`, `TEST_MONGO_URI`), which can be done via a `.env` file (see sample.env). One possible MongoDB service is **[MongoDB Atlas](https://www.mongodb.com/atlas/database)**.\n\nIn addition, a valid bcrypt salt is required to be entered as an environmental variable (`HASH_SALT`). One can be created by running `bcrypt.genSaltSync(12)`.\n\nA development mode (with auto server restart on file save), can be started with:\n\n`npm run dev`\n\nThe application can then be viewed at `http://localhost:3000/` in the browser.\n\nTo start the server without auto-restart on file save:\n\n`npm start`\n\nTo run the test suite:\n\n`npm test`\n\n# Stock Price Checker\n\nThe initial boilerplate for this app can be found at https://github.com/freeCodeCamp/boilerplate-project-stockchecker\n\nInstructions for building the project can be found at https://freecodecamp.org/learn/information-security/information-security-projects/stock-price-checker\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplcoster%2Ffcc_infosec_project1","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplcoster%2Ffcc_infosec_project1","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplcoster%2Ffcc_infosec_project1/lists"}