diff --git a/README.md b/README.md index a43702c..9611644 100644 --- a/README.md +++ b/README.md @@ -20,3 +20,35 @@ In the future ports will be changed to ensure proper communication between front - [Kristián Kluka](https://github.com/kristiankluka) - backend, SW architect related tasks - [Ľudovít Laca](https://github.com/Ludovit-Laca) - backend, DB design - [Martin Gajdoš](https://github.com/martingajdos) - design, frontend + +## Development setup + +### Backend + +1) Install Composer and XAMPP (php version 7.2) +2) Install required packages using Composer +```bash +composer install +``` +3) Create .env file in /backend from .env.example and generate `APP_KEY` using +```bash +php artisan key:generate +``` +4) Change `DB_HOST=mysql` in .env to your MySQL server IP + + Optional: change DB name or username/password to your preferred values + +5) Run `php artisan migrate:fresh --seed` to generate DB tables with data or `php artisan migrate` or `php artisan migrate --seed` to migrate tables and again run seeders + +6) Run `php artisan passport:keys` to generate files and keys required for Laravel Passport + +Notes: + +`php artisan route:list` to show every route + +### Frontend + +1) Install Node.js and npm +2) Run `npm install` in project folder to install required dependencies +3) In frontend .env configuration change API endpoint `VUE_APP_BACKEND_URL=` to your local address (probably `http://localhost/TP1-project/backend/public/api`), also do not commit your changes in this file +4) Run `npm run serve` to start frontend in development mode on `localhost:8080` \ No newline at end of file diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 3475f8d..2dc12d0 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -1,12 +1,11 @@ -# build stage -FROM node:lts-alpine as build-stage +FROM node:latest as build-stage WORKDIR /app COPY package*.json ./ RUN npm install -COPY . . +COPY ./ . RUN npm run build -# production stage -FROM nginx:stable-alpine as production-stage -COPY --from=build-stage /app/dist /usr/share/nginx/html -CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file +FROM nginx as production-stage +RUN mkdir /app +COPY --from=build-stage /app/dist /app +COPY nginx.conf /etc/nginx/nginx.conf \ No newline at end of file diff --git a/frontend/nginx.conf b/frontend/nginx.conf new file mode 100644 index 0000000..385df25 --- /dev/null +++ b/frontend/nginx.conf @@ -0,0 +1,30 @@ +user nginx; +worker_processes 1; +error_log /var/log/nginx/error.log warn; +pid /var/run/nginx.pid; +events { + worker_connections 1024; +} +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + access_log /var/log/nginx/access.log main; + sendfile on; + keepalive_timeout 65; + server { + listen 80; + server_name localhost; + location / { + root /app; + index index.html; + try_files $uri $uri/ /index.html; + } + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } + } +} \ No newline at end of file diff --git a/frontend/src/router.js b/frontend/src/router.js index 23f05a0..f8b1a1f 100644 --- a/frontend/src/router.js +++ b/frontend/src/router.js @@ -2,6 +2,7 @@ import Vue from "vue"; import Router from "vue-router"; import Home from "./views/Home.vue"; import ManageEvent from "./views/ManageEvent.vue"; +import NotFound from "./views/NotFound.vue"; Vue.use(Router); @@ -18,6 +19,10 @@ export default new Router({ path: "/pridat", name: "addEvent", component: ManageEvent + }, + { + path: "*", + component: NotFound } ] }); diff --git a/frontend/src/views/NotFound.vue b/frontend/src/views/NotFound.vue new file mode 100644 index 0000000..0944f96 --- /dev/null +++ b/frontend/src/views/NotFound.vue @@ -0,0 +1,20 @@ + + + + + \ No newline at end of file