A web app giving random advices
Clone this repository using git clone https://github.com/lukadriel7/advisor.git
This project was built using yarn, and requires node >= 14 and npm >= 6 to be installed. Those can be installed by visiting https://nodejs.org/en/
npm install --global yarn
Change directories to the root of the project
cd /path/to/this/directory
Install the project dependencies with
yarn
Docker can be used to build an image and launch a container of this application. You can install docker by following the instructions at https://docs.docker.com/get-docker/
You can install nginx following the instructions at https://www.nginx.com/resources/wiki/start/topics/tutorials/install/
The quasar cli can be used to serve build files. Install it using
npm install --global @quasar/cli
Create a file .env
at the root of the folder. You can use the .env.example
file as a template. The used environment variables are :
ADVICESLIP_API=https://api.adviceslip.com/advice #adviceslip API URL
ADVICE_MAX_NUMBER=224 # the number of advices available on the api
ADVICE_MIN_ENTRIES=5 # The smallest number of advice the user can request
ADVICE_MAX_ENTRIES=20 # The largest number of advice the user can request
LIBRETRANSLATE_API=https://libretranslate.de/translate #libretranslate API URL
Using Quasar cli:
quasar dev
Using yarn:
yarn dev
Visit http://localhost:8080 in your browser
Using Quasar cli:
quasar build
Using yarn:
yarn build
Run the following command to create an image
docker build . -t [TAG_NAME]
Launch a container using:
docker run --name [CONTAINER_NAME] -d -p [PORT_NUMBER]:80 [TAG_NAME]
Visit http://localhost:[PORT_NUMBER] in your browser
In the nginx configuration file, add under html add a server block similar to the following:
server {
listen 80;
server_name localhost 127.0.0.1;
location / {
alias /data/www/;
index index.html;
try_files $uri $uri/ index.html;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
copy the content of dist/spa
to /data/www
Make sure to remove all other default server configuration already existing. Visit http://localhost in your browser
After building the application for production, use the following command to launch a local server
quasar serve --history dist/spa
Visit http://localhost:4000 in your browser you can read more about the serve command at https://quasar.dev/quasar-cli/commands-list#serve
Enter a number in the input element to get the corresponding number of advices both in english and a side by side english and polish translation.