A real-time console log visualization tool designed for developers working on coding problems who want to see their debug output on a separate screen (localhost:3000). This tool automatically mirrors all console.log statements from your main.js code to a clean, readable web interface.
- Backend: Node.js with Express
- Real-time Communication: Socket.IO
- Frontend: Plain HTML/CSS/JavaScript
- Development: Nodemon for auto-reloading
- Testing: Jest
When solving coding problems, debugging with console.log statements is common practice. However, constantly switching between your code editor and terminal can break your flow. This tool allows you to:
- Write and debug your solution code in
main.js - See all console output in real-time on a separate browser window
- Maintain a history of console logs across code runs
- Clone this repository:
git clone https://github.com/dennisrcao/js-coding-assessment-localhost.git
cd js-coding-assessment-template- Install dependencies:
npm install- Start the development server:
npm start- Open
http://localhost:3000in your browser
The template is structured to help you focus on solving coding problems while providing real-time debugging feedback:
- Navigate to the
ALGORITHMsection inmain.js:
//================================= ALGORITHM =================================//
function lengthOfLongestSubstring(s) {
// Replace this function with your solution
// Add console.log statements for debugging
}- Replace the sample function with your own solution code
- Use
console.logstatements liberally for debugging - they'll appear in real-time on localhost
- Find the
TESTSsection inmain.js:
const testCases = [
{ input: 'abcabcbb', expected: 3 },
{ input: 'bbbbb', expected: 1 },
// Add your test cases here
];- Modify the test cases array to match your problem:
- Each test case should be an object with
inputandexpectedproperties - Adjust the data types to match your function's parameters
- Each test case should be an object with
- Start the server:
npm start - Open
http://localhost:3000in your browser - Your console output will appear in real-time as you save changes to
main.js - The test results will show which cases passed or failed
Your localhost page will display something like:
Processing string: "abcabcbb"
Processing character: a at index: 0
Current substring: "a" (length: 1)
Processing character: b at index: 1
Current substring: "ab" (length: 2)
...
Test Case 1: Passed ✓
main.js- Write your solution code hereserver.js- Express server and Socket.IO setupindex.html- Web interface for console outputtests/- Jest test files
npm testThe repository includes a sample implementation of the "Longest Substring Without Repeating Characters" problem to demonstrate usage.
Feel free to submit issues and enhancement requests!
ISC