Skip to content

i-am-jun/nodejs-interivew-prep

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NODEJS INTERVIEW QUESTIONS REPO

The way this repo is structured:

  • Each subfolder represents a logical subsection and contains code examples pertaining to the same subject. Those subfolders' names start with numbers,
  • Inside of numbered subfolders, are unnumbered folders whose names represent subject of an interview question,
  • Each of those, contains either expressjs and nestjs examples separately, or has one working application sourcecode.

How to run any code example:

  • All code examples are runnable
  • All code examples were prepared to be run either on their own using node <filename.js>, in standalone Docker containers or via docker-compose
  • Run pnpm i or yarn or npm i in the root directory first
  • This repo uses a Makefile to make it easy to run any code example. The Makefile performs logic behind the scenes to "just run" the example correctly
  • The only Makefile command you should be using is either the up or down command. You need to pass CODE_PATH argument into it with relative path of the folder with example you want to run
  • So a full command to run a code example needs to look like this:

make up CODE_PATH=11-app-construction/controller/controller-express

  • when done with running an example you can use an analogous script to stop it:

make down CODE_PATH=11-app-construction/controller/controller-express

Benefits of this approach:

  • Single package.json, tsconfig, yarn.lock, Dockerfile files - few times less files for the entire repo
  • Single node_modules for adjusting and expanding examples - much smaller size of the entire repo when used
  • Isolation of examples and thus bigger independence in modifying them

Inefficiencies of this approach

  • Single package.json means every Dockerimage installs more dependencies than needed
  • The act of starting the example will take longer (for Docker to do its thing) - this is offset by not having to manually navigate to example's folder, installing dependencies etc.
  • It is not a monorepo so running tasks via Make scripts could be a little clunky

HACKS

  • use ENTRYPOINT ["tail", "-f", "/dev/null"] in dockerfile to keep the container alive indefinitely to inspect it in case of issues

DEPENDENCIES

  • Node version >= 18
  • make

    MAC: brew install make
    WINDOWS: Install Git for Windows & use included Git Bash
    WSL2: sudo apt-get install make

  • Docker (including docker-compose)

About

Nodejs-interview-prep

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors