mirror of
https://github.com/Xevion/the-office.git
synced 2025-12-15 10:13:30 -06:00
add vue client folders, rename server files accordingly and update code
This commit is contained in:
@@ -1,3 +1,3 @@
|
|||||||
FLASK_APP=the_office.create_app
|
FLASK_APP=server.create_app
|
||||||
FLASK_ENV=development
|
FLASK_ENV=development
|
||||||
FLASK_DEBUG=1
|
FLASK_DEBUG=1
|
||||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -10,6 +10,9 @@ test.html
|
|||||||
app/data/raw/*.html
|
app/data/raw/*.html
|
||||||
app/data/preprocess/*.json
|
app/data/preprocess/*.json
|
||||||
flaskenv
|
flaskenv
|
||||||
|
algolia.json
|
||||||
|
*.scss.css
|
||||||
|
node_modules/**
|
||||||
|
|
||||||
# Byte-compiled / optimized / DLL files
|
# Byte-compiled / optimized / DLL files
|
||||||
__pycache__/
|
__pycache__/
|
||||||
|
|||||||
7
client/.editorconfig
Normal file
7
client/.editorconfig
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
[*.{js,jsx,ts,tsx,vue}]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
end_of_line = lf
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
max_line_length = 100
|
||||||
22
client/.gitignore
vendored
Normal file
22
client/.gitignore
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
.DS_Store
|
||||||
|
node_modules
|
||||||
|
/dist
|
||||||
|
|
||||||
|
# local env files
|
||||||
|
.env.local
|
||||||
|
.env.*.local
|
||||||
|
|
||||||
|
# Log files
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
pnpm-debug.log*
|
||||||
|
|
||||||
|
# Editor directories and files
|
||||||
|
.idea
|
||||||
|
.vscode
|
||||||
|
*.suo
|
||||||
|
*.ntvs*
|
||||||
|
*.njsproj
|
||||||
|
*.sln
|
||||||
|
*.sw?
|
||||||
29
client/README.md
Normal file
29
client/README.md
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
# client
|
||||||
|
|
||||||
|
## Project setup
|
||||||
|
```
|
||||||
|
npm install
|
||||||
|
```
|
||||||
|
|
||||||
|
### Compiles and hot-reloads for development
|
||||||
|
```
|
||||||
|
npm run serve
|
||||||
|
```
|
||||||
|
|
||||||
|
### Compiles and minifies for production
|
||||||
|
```
|
||||||
|
npm run build
|
||||||
|
```
|
||||||
|
|
||||||
|
### Run your tests
|
||||||
|
```
|
||||||
|
npm run test
|
||||||
|
```
|
||||||
|
|
||||||
|
### Lints and fixes files
|
||||||
|
```
|
||||||
|
npm run lint
|
||||||
|
```
|
||||||
|
|
||||||
|
### Customize configuration
|
||||||
|
See [Configuration Reference](https://cli.vuejs.org/config/).
|
||||||
5
client/babel.config.js
Normal file
5
client/babel.config.js
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
module.exports = {
|
||||||
|
presets: [
|
||||||
|
'@vue/cli-plugin-babel/preset',
|
||||||
|
],
|
||||||
|
};
|
||||||
12007
client/package-lock.json
generated
Normal file
12007
client/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
47
client/package.json
Normal file
47
client/package.json
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
{
|
||||||
|
"name": "client",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"serve": "vue-cli-service serve",
|
||||||
|
"build": "vue-cli-service build",
|
||||||
|
"lint": "vue-cli-service lint"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"core-js": "^3.6.5",
|
||||||
|
"vue": "^2.6.11",
|
||||||
|
"vue-router": "^3.2.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@vue/cli-plugin-babel": "^4.4.0",
|
||||||
|
"@vue/cli-plugin-eslint": "^4.4.0",
|
||||||
|
"@vue/cli-service": "^4.4.0",
|
||||||
|
"@vue/eslint-config-airbnb": "^5.0.2",
|
||||||
|
"babel-eslint": "^10.1.0",
|
||||||
|
"eslint": "^6.7.2",
|
||||||
|
"eslint-plugin-import": "^2.20.2",
|
||||||
|
"eslint-plugin-vue": "^6.2.2",
|
||||||
|
"sass": "^1.26.5",
|
||||||
|
"sass-loader": "^8.0.2",
|
||||||
|
"vue-template-compiler": "^2.6.11"
|
||||||
|
},
|
||||||
|
"eslintConfig": {
|
||||||
|
"root": true,
|
||||||
|
"env": {
|
||||||
|
"node": true
|
||||||
|
},
|
||||||
|
"extends": [
|
||||||
|
"plugin:vue/essential",
|
||||||
|
"@vue/airbnb"
|
||||||
|
],
|
||||||
|
"parserOptions": {
|
||||||
|
"parser": "babel-eslint"
|
||||||
|
},
|
||||||
|
"rules": {}
|
||||||
|
},
|
||||||
|
"browserslist": [
|
||||||
|
"> 1%",
|
||||||
|
"last 2 versions",
|
||||||
|
"not dead"
|
||||||
|
]
|
||||||
|
}
|
||||||
BIN
client/public/favicon.ico
Normal file
BIN
client/public/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
17
client/public/index.html
Normal file
17
client/public/index.html
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||||
|
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||||
|
<title><%= htmlWebpackPlugin.options.title %></title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<noscript>
|
||||||
|
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
||||||
|
</noscript>
|
||||||
|
<div id="app"></div>
|
||||||
|
<!-- built files will be auto injected -->
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
5
client/src/App.vue
Normal file
5
client/src/App.vue
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<template>
|
||||||
|
<div id="app">
|
||||||
|
<router-view/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
36
client/src/components/Books.vue
Normal file
36
client/src/components/Books.vue
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<template>
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<h1>Books</h1>
|
||||||
|
<hr>
|
||||||
|
<br><br>
|
||||||
|
<button type="button" class="btn btn-success btn-sm">Add Book</button>
|
||||||
|
<br><br>
|
||||||
|
<table class="table table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Title</th>
|
||||||
|
<th scope="col">Author</th>
|
||||||
|
<th scope="col">Read?</th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>foo</td>
|
||||||
|
<td>bar</td>
|
||||||
|
<td>foobar</td>
|
||||||
|
<td>
|
||||||
|
<div class="btn-group" role="group">
|
||||||
|
<button type="button" class="btn btn-warning btn-sm px-2">Update</button>
|
||||||
|
<button type="button" class="btn btn-danger btn-sm px-1">Delete</button>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
28
client/src/components/Ping.vue
Normal file
28
client/src/components/Ping.vue
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<script>
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'Ping',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
msg: '',
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getMessage() {
|
||||||
|
const path = 'http://localhost:5000/ping';
|
||||||
|
axios.get(path)
|
||||||
|
.then((res) => {
|
||||||
|
this.msg = res.data;
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
// eslint-disable-next-line
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getMessage();
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
11
client/src/main.js
Normal file
11
client/src/main.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import 'bootstrap/dist/css/bootstrap.css';
|
||||||
|
import Vue from 'vue';
|
||||||
|
import App from './App.vue';
|
||||||
|
import router from './router';
|
||||||
|
|
||||||
|
Vue.config.productionTip = false;
|
||||||
|
|
||||||
|
new Vue({
|
||||||
|
router,
|
||||||
|
render: h => h(App),
|
||||||
|
}).$mount('#app');
|
||||||
23
client/src/router.js
Normal file
23
client/src/router.js
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import Vue from 'vue';
|
||||||
|
import Router from 'vue-router';
|
||||||
|
import Books from './components/Books.vue';
|
||||||
|
import Ping from './components/Ping.vue';
|
||||||
|
|
||||||
|
Vue.use(Router);
|
||||||
|
|
||||||
|
export default new Router({
|
||||||
|
mode: 'history',
|
||||||
|
base: process.env.BASE_URL,
|
||||||
|
routes: [
|
||||||
|
{
|
||||||
|
path: '/',
|
||||||
|
name: 'Books',
|
||||||
|
component: Books,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/ping',
|
||||||
|
name: 'Ping',
|
||||||
|
component: Ping,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
30
package-lock.json
generated
Normal file
30
package-lock.json
generated
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"requires": true,
|
||||||
|
"lockfileVersion": 1,
|
||||||
|
"dependencies": {
|
||||||
|
"axios": {
|
||||||
|
"version": "0.18.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/axios/-/axios-0.18.0.tgz",
|
||||||
|
"integrity": "sha1-MtU+SFHv3AoRmTts0AB4nXDAUQI=",
|
||||||
|
"requires": {
|
||||||
|
"follow-redirects": "^1.3.0",
|
||||||
|
"is-buffer": "^1.1.5"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"bootstrap": {
|
||||||
|
"version": "4.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.3.1.tgz",
|
||||||
|
"integrity": "sha512-rXqOmH1VilAt2DyPzluTi2blhk17bO7ef+zLLPlWvG494pDxcM234pJ8wTc/6R40UWizAIIMgxjvxZg5kmsbag=="
|
||||||
|
},
|
||||||
|
"follow-redirects": {
|
||||||
|
"version": "1.12.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.12.1.tgz",
|
||||||
|
"integrity": "sha512-tmRv0AVuR7ZyouUHLeNSiO6pqulF7dYa3s19c6t+wz9LD69/uSzdMxJ2S91nTI9U3rt/IldxpzMOFejp6f0hjg=="
|
||||||
|
},
|
||||||
|
"is-buffer": {
|
||||||
|
"version": "1.1.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
|
||||||
|
"integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,10 +3,6 @@ python-dotenv~=0.14.0
|
|||||||
libsass~=0.20.0
|
libsass~=0.20.0
|
||||||
gunicorn~=20.0.4
|
gunicorn~=20.0.4
|
||||||
Flask-WTF~=0.14.3
|
Flask-WTF~=0.14.3
|
||||||
# flask-sqlalchemy~=2.4.4
|
|
||||||
# psycopg2~=2.8.5
|
|
||||||
# Flask-Migrate~=2.5.3
|
|
||||||
# SQLAlchemy~=1.3.18
|
|
||||||
# alembic~=1.4.2
|
|
||||||
click~=7.1.2
|
click~=7.1.2
|
||||||
Werkzeug~=1.0.1
|
Werkzeug~=1.0.1
|
||||||
|
Flask-CORS~=3.0.8
|
||||||
@@ -7,9 +7,9 @@ Stores all configurations used by the application from database URLs to Secret k
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
configs = {
|
configs = {
|
||||||
'development': 'the_office.config.DevelopmentConfig',
|
'development': 'server.config.DevelopmentConfig',
|
||||||
'testing': 'the_office.config.TestingConfig',
|
'testing': 'server.config.TestingConfig',
|
||||||
'production': 'the_office.config.ProductionConfig'
|
'production': 'server.config.ProductionConfig'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -7,14 +7,16 @@ import json
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
from flask import Flask, render_template
|
from flask import Flask, render_template
|
||||||
|
from flask_cors import CORS
|
||||||
from flask_wtf.csrf import CSRFProtect
|
from flask_wtf.csrf import CSRFProtect
|
||||||
from sassutils.wsgi import SassMiddleware
|
from sassutils.wsgi import SassMiddleware
|
||||||
from werkzeug.exceptions import HTTPException
|
from werkzeug.exceptions import HTTPException
|
||||||
|
|
||||||
from the_office.config import configs
|
from server.config import configs
|
||||||
|
|
||||||
csrf = CSRFProtect()
|
csrf = CSRFProtect()
|
||||||
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
cors = CORS(resources={r'/*': {'origins': '*'}})
|
||||||
|
|
||||||
|
|
||||||
def create_app(env=None):
|
def create_app(env=None):
|
||||||
@@ -25,7 +27,7 @@ def create_app(env=None):
|
|||||||
|
|
||||||
# Add Sass middleware (black magic)
|
# Add Sass middleware (black magic)
|
||||||
app.wsgi_app = SassMiddleware(app.wsgi_app, {
|
app.wsgi_app = SassMiddleware(app.wsgi_app, {
|
||||||
'the_office': ('static/sass', 'static/css', '/static/css', False)
|
'server': ('static/sass', 'static/css', '/static/css', False)
|
||||||
})
|
})
|
||||||
|
|
||||||
# Load configuration values
|
# Load configuration values
|
||||||
@@ -39,6 +41,7 @@ def create_app(env=None):
|
|||||||
|
|
||||||
# Initialize Flask extensions
|
# Initialize Flask extensions
|
||||||
csrf.init_app(app)
|
csrf.init_app(app)
|
||||||
|
cors.init_app(app)
|
||||||
|
|
||||||
# flask_static_digest.init_app(app)
|
# flask_static_digest.init_app(app)
|
||||||
# CLI commands setup
|
# CLI commands setup
|
||||||
@@ -68,6 +71,6 @@ def create_app(env=None):
|
|||||||
# noinspection PyUnresolvedReferences
|
# noinspection PyUnresolvedReferences
|
||||||
with app.app_context():
|
with app.app_context():
|
||||||
# noinspection PyUnresolvedReferences
|
# noinspection PyUnresolvedReferences
|
||||||
from the_office import routes
|
from server import routes
|
||||||
|
|
||||||
return app
|
return app
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user