refined backend skeleton

This commit is contained in:
Claudio Maggioni 2023-05-03 10:54:36 +02:00
parent 3f5f01a1da
commit 9098175f2c
8 changed files with 44 additions and 91 deletions

0
backend/api/.gitkeep Normal file
View file

View file

@ -0,0 +1,12 @@
import os
import subprocess
def build_frontend():
"""
builds the frontend application
"""
path: str = os.path.join(os.path.dirname(__file__), "..", "..", "stockingly-frontend")
p = subprocess.Popen(["yarn", "build"], cwd=path)
p.wait()

View file

@ -5,7 +5,7 @@
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Welcome to Vuetify 3</title>
<title>Stockingly</title>
</head>
<body>

View file

@ -1,75 +0,0 @@
<template>
<v-container class="fill-height">
<v-responsive class="d-flex align-center text-center fill-height">
<v-img height="300" src="@/assets/logo.svg" />
<div class="text-body-2 font-weight-light mb-n1">Welcome to</div>
<h1 class="text-h2 font-weight-bold">Vuetify</h1>
<div class="py-14" />
<v-row class="d-flex align-center justify-center">
<v-col cols="auto">
<v-btn
href="https://vuetifyjs.com/components/all/"
min-width="164"
rel="noopener noreferrer"
target="_blank"
variant="text"
>
<v-icon
icon="mdi-view-dashboard"
size="large"
start
/>
Components
</v-btn>
</v-col>
<v-col cols="auto">
<v-btn
color="primary"
href="https://vuetifyjs.com/introduction/why-vuetify/#feature-guides"
min-width="228"
rel="noopener noreferrer"
size="x-large"
target="_blank"
variant="flat"
>
<v-icon
icon="mdi-speedometer"
size="large"
start
/>
Get Started
</v-btn>
</v-col>
<v-col cols="auto">
<v-btn
href="https://community.vuetifyjs.com/"
min-width="164"
rel="noopener noreferrer"
target="_blank"
variant="text"
>
<v-icon
icon="mdi-account-group"
size="large"
start
/>
Community
</v-btn>
</v-col>
</v-row>
</v-responsive>
</v-container>
</template>
<script lang="ts" setup>
//
</script>

View file

@ -1,13 +1,23 @@
<template>
<v-app-bar flat>
<v-app-bar color="primary">
<v-app-bar-title>
<v-icon icon="mdi-circle-slice-4" />
Base Preset
Stockingly
</v-app-bar-title>
<v-tabs centered>
<v-tab v-for="link in links" :key="link">
{{ link }}
</v-tab>
</v-tabs>
<v-spacer></v-spacer>
</v-app-bar>
</template>
<script lang="ts" setup>
//
const links = [
'Dashboard',
'Messages',
'Profile',
'Updates',
];
</script>

View file

@ -14,11 +14,12 @@ import { createVuetify } from 'vuetify'
// https://vuetifyjs.com/en/introduction/why-vuetify/#feature-guides
export default createVuetify({
theme: {
defaultTheme: 'light',
themes: {
light: {
colors: {
primary: '#1867C0',
secondary: '#5CBBF6',
primary: '#009688',
secondary: '#ff4081',
},
},
},

View file

@ -1,7 +1,6 @@
<template>
<HelloWorld />
<marquee><h1>Viva Luciano Malusa</h1></marquee>
</template>
<script lang="ts" setup>
import HelloWorld from '@/components/HelloWorld.vue'
</script>

View file

@ -1,5 +1,9 @@
from flask import Flask, jsonify, send_from_directory
from flask import Flask, jsonify, redirect, url_for, send_from_directory
from flask_cors import CORS
from backend.utils.build_frontend import build_frontend
import os
import subprocess
# instantiate the app
app = Flask(__name__, static_url_path='/static', static_folder='stockingly-frontend/dist')
@ -8,10 +12,12 @@ app.config.from_object(__name__)
# enable CORS
CORS(app, resources={r'/*': {'origins': '*'}})
# sanity check route
@app.route('/ping', methods=['GET'])
def ping_pong():
return jsonify('pong!')
@app.route('/', methods=['GET'])
def index():
return redirect(url_for('static', filename='index.html'))
if __name__ == '__main__':
app.run()
build_frontend()
app.run()