-
Notifications
You must be signed in to change notification settings - Fork 1
jabdo/technicolortestserver
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Installation: Install LAMP stack, or your preferred web stack with Apache and PHP. Install MongoDB, php5, and mongo-php to make sure that Add 'extension=mongo.so' to php.ini Add user "technicolor," pw "testbed" to the mongo database To import the test collection, use mongoimport, and call the database "backendtest". The collection should be named "user", or renamed accordingly in "login.php", and a test file, "usercollection.json", is provided. The following command can be mongoimport --db backendtest --collection user --file usercollection.json Files: index.html - takes the login information and passes it using POST to login.php login.php- this sets a login cookie, fetches the data from Mongo, and sorts and groups it. In a production environment, the cookie would correspond to a session with an ID that is kept in the Mongo database. It provides the database ID of the user, the username, their password, their location, which is either Chicago or Seattle, and their favorite color, which is either yellow, orange, or red for this sample data. In a production file, the username and password would be stored as a hash, along with a salt, in order to keep the data private. showls.php- this shows the contents of the current directory. In production, this could be modified to require login using a cookie, but for ease of parsing using an automatic script, this was not implemented. This could also take arguments from GET to pick which directory one wanted to view. status.php- shows whether php is installed, mongo is running, and it's PID, and whether apache is running or not. usercollection.json- this contains test data for sample users. It contains the user name, the password, the user's location, Note: The security here is designed to be easy to insert test values, with plaintext values for username and passwords. In production, hash and salts would be used to store and check username and password values. Also, the login cookie would corespond to a login entry in the database. Technologies: PHP was chosen for ease of installation and because it natively outputs HTML. Ruby and Python were considered as well, for their ease of use and easy parsing. Versioning is used by having a repository that keeps the latest version of the file. A private repository could also be kept to keep the details of the code private. Pagination can be implemented in the print funcion, by having buttons that only return a small number of results at a time.
About
This implements an endpoint exercise using Mongo
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published