This is the boilerplate for the Stock Price Checker project. Instructions for building your project can be found at https://freecodecamp.org/learn/information-security/information-security-projects/stock-price-checker
- GET
/api/stock-pricesendpoint accepting one or two NASDAQ symbols. - Optional
like=truequery to record a like from the requesting IP (anonymized via SHA-256). - Content Security Policy applied with Helmet allowing only same-origin scripts and styles.
- In-memory store for likes with per-IP deduplication.
- Functional tests covering all required behaviors.
- Install dependencies:
npm install
- Start the server (default port 3000):
npm start
- Open http://localhost:3000 in your browser.
Set the NODE_ENV environment variable to test before starting the server. This triggers the built-in Mocha test runner used by FreeCodeCamp.
NODE_ENV=test node server.jsAlternatively, you can run the tests directly if you prefer:
npm install -g mocha
mocha tests/2_functional-tests.jsAll tests are located in tests/2_functional-tests.js and assert the API behaves as specified by the challenge.
Note: likes are stored in memory and will reset when the server restarts. This is acceptable for the purpose of the coding challenge.