„Generator für Aufgaben und Lösung(shilf)en aus der Informatik und angrenzenden Disziplinen“
Aladin aims to be a progressive web app, which offers a platform to students of various disciplines of study, on that exam-relevant tasks can be generated in a choosen degree of difficulty and can be solved with additional help and instruction without the need of a physically present professor/research assistant.
Also the randomly generated tasks provide a discharge on the professors in terms of preparing exams.
The current state of the app is hosted here
The swagger api documentation can be found here
-
Node.js which can be downloaded here: https://nodejs.org/en/
-
Vue.js which can be download via npm: https://vuejs.org/v2/guide/installation.html#NPM
-
Github Account + Locally installed Git
- Follow along Tutorial: https://dev.to/bdbch/setting-up-ssh-and-git-on-windows-10-2khk
-
Local or hosted MongoDB
- Follow along Tutorial for local setup and connecting via mongoose and node.js: https://zellwk.com/blog/local-mongodb/
- Free cloud based option: https://www.mongodb.com/download-center
(optional but recommended)
-
Docker https://www.docker.com/
-
Vue DevTools for
-
The ESLint and Prettier - Code Formatter Plugins which are available for most common IDEs and editors.
After installing all the prerequisites clone the repository into a local folder of your choice.
To install the dependencies for the backend and the frontend run the command
npm install --save
in the server and the frontend directory.
The server references a couple environment-variables that need to be setup as well. In order to do so, a .env-File has to be created in the server folder of the repository.
- Example .env-File:
mongooseConnection=mongodb://<USER>:<PASSWORD>@<LOCATION>
sqlFlavour=sqlite
publicVapidKey=<PUBLIC_KEY>
privateVapidKey=<PRIVATE_KEY>
NODE_ENV=development
jwtSecret=<RANDOM_LONG_PASSWORD>
A JWT-secret can be generated via:
- this website https://mkjwk.org/
- simply using a random long password/salt, e.g. generated by
/dev/urandom
of the linux os - further reference: https://github.com/dwyl/learn-json-web-tokens
A vapid-key-pair signed to your email can be generated via:
- this website https://tools.reactpwa.com/vapid?email=test%40test.de (ONLY FOR TESTING PURPOSES!)
- installing web-push globally via npm and generating the key-pair on your command-line: https://www.npmjs.com/package/web-push
The connection string for your local MongoDB-Instance should look similar to mongodb://127.0.0.1:27017/<NAME_OF_YOUR_DATABASE>
The standard SQL-Flavour used is SQLite3 which is why the existing databases are not version controlled in this repository due to size limitations.
They can be downloaded here.
Unpack the zip-archive into ./server/exercises/sql/database
to provide data for the SQL-exercise.
If you would rather use another SQL-dialect/database you would need to expand the SQL-Adapter with an object providing the necessary functions and information, install the driver-package for node.js, as well as changing the sqlFlavour in the .env-File to the corresponding key you used. It would also be a good idea to extend the .env-File with a field for your SQL-connection-string and your password-string, which you can then access in your provided connection function.
This is the recommended way, since it eliminates unexpected behaviour due to different environments and OS. As of right now only the mongodb and the webserver are containerized, as the frontend is not susceptible to differing environments and comes already shipped with a development server due to being a vue application.
To spin up the mongodb and webserver simply run docker-compose up
in the root directory of the repository. The vue development server can be started by executing npm run serve
in the frontend directory.
Injecting the environment variables still works via the .env file in the server directory. If the mongodb docker container is used the name of the container functions as the hostname that has to be used in the connection string.
E.g. mongodb://mongo_container
In order to run the app for development purposes you would need two command line instances.
Backend
To run the server enter the server directory and execute npm run dev
. This also hot-reloads the server on change.
You could also run npm run start
if you would like to disable this option or run the server.js in debug mode in the IDE of your choice.
When using the docker option you can either use docker-compose or docker to build and start the backend container.
E.g. docker-compose up
or docker run -p 3000:3000 server
.
Frontend
In order to run the frontend for development navigate your command line to /frontend and execute npm run serve
.
In development CORS is allowed due to the applications running on different ports and the requests are being automatically proxied from the frontends :8080 port to the servers :3000 port.
For adjustments check the vue.config.js in the /frontend directory and the server.js-file in the root directory.
In order to deploy your changes on the frontend run the npm run build
command in a terminal opened in the /frontend directory.
This automatically deploys the compiled code to the /server/public folder.
To adjust that referr to the outputDir-option in the /frontend/vue.config.js-file.
Since the current version is hosted on Heroku, which automatically serves a secure connection, there is no https-Server being deployed in the code. To provide a secure connection refer to this tutorial: https://flaviocopes.com/express-https-self-signed-certificate/
There also is a semi-automatic deployment-process, which is triggered by pushing changes to the deploy-branch of this repository.
Requires a free gitpod account and the setup of user-specific env variables to build and run the repository. See env-variables configuration on how to achieve that. The required variables are identical to the example in the readme.