The purpose of this exercise is to demonstrate expertise with several technologies and across the web development stack.
In python, create a script that exposes 2 ports, 11211 and 8000. On the first port, expose a subset of memcached functionality, set, get and delete. On the second port, serve a basic web site that displays the current list of key/value pairs maintained by memcached.
- The Python program must be able to accept multiple connections at once.
- The data must be persistent, i.e. stored in a database.
- The web site can be simple, but should use a modern framework.
- Values should be hidden with JS and only exposed when a user clicks to view.
- User should be able to add/update/delete key/value pairs.
- Clone the repo
$ git clone https://github.com/mittelman29/ClientServerExercise.git
- Install Memcached If you're on Mac, run:
$ brew install memcached
- For all other OS flavors or for more detailed instructions: https://github.com/memcached/memcached/wiki/Install
- Run memcached on port 11311 (default is 11211)
$ memcached -p 11311 &
- Install prerequisites for data tier
$ sudo pip install python-binary-memcached
- Install prerequisites for web tier
$ cd ClientServerExercise/monitoring-site
$ npm i
- Build the React site
$ npm run build
- Run the service
- You may choose any database name you'd like, but to see sample data populated, use 'database.sqlite'
$ cd ..
$ python main.py <db_name>
- Happy hacking!
- To view the monitoring site, navigate to http://localhost:8000
- To interact with the data service, navigate to the base url(http://localhost:11211) and use the following url suffixes:
- base url + / => list all key/value pairs
- base url + /key => view single key/value pair
- base url + /set?key=value => create/update a key/value pair
- base url + /del/key => delete a key/value pair
This was written for demonstration and educational purposes only and is freely shared with the public. Please feel free to clone, fork or spoon this code as you see fit.
This is a work of fiction. Names, characters, businesses, places, events, locales, and incidents are either the products of the author's imagination or used in a fictitious manner. Any resemblance to actual persons, living or dead, or actual events is purely coincidental.