Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
Web-Server-API ----------------------------------- Created by: Justin Irazabal <[email protected]> Catherine Castagna <[email protected]> Jonathan Martin <[email protected]> Phil Attoh-Okine <[email protected]> Ryan Dotts <[email protected]> Fall 2018 for the University of Delaware Monica Mooney <[email protected]> Richard Bowen <[email protected]> Brittany Pham <[email protected]> Logan Muir <[email protected]> Maaz Nasir <[email protected]> Wei Zhang <[email protected]> Spring 2019 for the University of Delaware ----------------------------------- This is the API for the web-based Moodle -> MongoDB application [TODO: Think of an actual name] created for the University of Delaware CISC Department. The purpose of this application is to allow the import of questions into MongoDB after exporting them from Moodle, and to allow a user to add and edit data about each question, to aid in test creation for CISC 106 (General Computer Science for Engineers, an introductory programming class using Python). ----------------------------------- Dependencies (note these are the versions the software was created with, not minimums): ----------------------------------- mongodb 4.03 node 8.12.0 npm 6.4.1 cookie-parser 1.4.3 cors 2.8.5 ejs 2.6.1 express 4.16.4 fs-extra 8.0.1 http-errors 1.7.1 jquery 3.4.1 mongoose 5.3.11 morgan 1.9.1 prompt 1.0.0 rimraf 2.6.2 targz 1.0.1 tunnel-ssh 4.1.4 xml-writer 1.7.0 xml2js 0.4.19 the npm packages listed in package.json No known conflicts arise from installing the components in any particular order. ****************************** * IMPORTANT NOTE FOR MONGODB * ****************************** The version of mongodb in the Ubuntu repositories is outdated, and neither created nor maintained by MongoDB. Furthermore, it WILL cause conflicts with the official version. Follow the instructions at https://docs.mongodb.com/manual/installation/ to either add a repository and install the "mongodb-org" package or download the binaries. You can also find and compile the source code from https://github.com/mongodb/mongo. ****************************** ----------------------------------- Instructions ----------------------------------- Once all components are installed and mongod is running on the server, navigate to Web-Server-API/node-rest-api/ and run the server with "npm start". The server will confirm a connection with Mongo and listen on port 3000 on all interfaces for http methods (GET, POST, etc. - see express). The API expects a file with extension .mbz, a moodle export format that is simply a .tar.gz file with a large directory tree and various .xml files. Each file is expected to contain a single question. Autostarting and running as a service Edit the username and group in web-server-api.service, use chown to change the owner, and move the file to /etc/systemd/system/ (requires sudo privileges). Run the command "systemctl enable web-server-api.service", and run "service web-server-api start". Use "service web-server-api status" to check the status (duh) and "service web-server-api restart" if needed (systemd SHOULD restart it in the event of a crash, but if it doesn't, or you just need to restart it because you updated the code, that's the command). This should both act as a watchdog and autostart the server when the PC boots. Be aware that systemctl/systemd is one of the less UNIX-y things about Linux, and some people hate it passionately. A few distros don't use it at all, but anything even relatively mainstream should be fine. MacOS uses launchd/launchctl, which is similar I guess? There's probably something in the GUI that can do it too, maybe? In Windows, just drop a shortcut that executes "npm start" into the Start menu's Startup folder and call it a day to autostart. If you also want to restart after crashes, using Task Scheduler is probably easier than making a custom Windows Service; just set it to run every five minutes or something and only allow one instance to run. ----------------------------------- Known Issues ----------------------------------- Conflict between ubuntu packages "mongodb" and "mongodb-org" (see note in Dependencies section). MongoDB is supposed wo run with local user permissions, but version 4.03 will not run without access wo unknown shared libraries. Installation using the MongoDB repository is suggested.