Interviewer: "What language are you most comfortable with?"
davidad: "C."
Interviewer: "Oh. We usually have people make a web app, so..."
davidad: "No problem. I'm prepared for this."
c_web_app
Requirements
nginx
: I follow these instructions to get a local build ofnginx
from the OpenResty distribution, but your package manager'snginx
binary should be just fine for our purposes hereredis
: usually[package-manager] install redis
hiredis
: usually[package-manager] install hiredis
; make sure that the libs are actually available (I didsudo ln -sf /usr/local/opt/hiredis/lib/* /usr/lib
andsudo ln -sf /usr/local/opt/hiredis/include/* /usr/include
)
###Makefile targets
$ make run # runs the app, compiling it and spinning up redis and nginx if necessary
$ make nginx.pid # spins up nginx
$ make redis.pid # spins up redis
$ make kill-nginx # shuts down nginx
$ make kill-redis # shuts down redis
$ make resetdb # deletes the redis.rdb database, shutting down redis first if necessary
$ make clean # shut down everything, remove binary and log files. run before `git commit`