reverse proxy
This commit is contained in:
parent
e7a6dc5cd8
commit
4894eae14f
16
example-nginx.conf
Normal file
16
example-nginx.conf
Normal file
@ -0,0 +1,16 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name www.example.com;
|
||||
|
||||
location / {
|
||||
root /path/to/aliexpress-price-tracker/web;
|
||||
index app.html;
|
||||
}
|
||||
location ~ ^/app/(.*)$ {
|
||||
proxy_pass http://127.0.0.1:8080/$1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
Flask
|
||||
flask-cors
|
||||
gunicorn
|
||||
psycopg2-binary
|
||||
requests
|
||||
|
@ -1,9 +1,11 @@
|
||||
from flask import Flask, request, jsonify
|
||||
from flask_cors import CORS
|
||||
import requests, re, json, os, yaml
|
||||
from db import *
|
||||
from aliexpress import *
|
||||
|
||||
app = Flask(__name__)
|
||||
CORS(app)
|
||||
|
||||
def get_conf():
|
||||
'''return settings in settings.yaml file'''
|
||||
|
@ -13,7 +13,6 @@ const width = window.innerWidth - margin.right - margin.left -10;
|
||||
|
||||
// url
|
||||
const currentUrl = window.location.href;
|
||||
console.log(currentUrl);
|
||||
|
||||
|
||||
// reload page when window is resized
|
||||
@ -22,7 +21,7 @@ window.onresize = function(){ location.reload(); }
|
||||
|
||||
async function fetch_history() {
|
||||
try {
|
||||
const response = await fetch(`${currentUrl}/datahistory`);
|
||||
const response = await fetch(`${currentUrl}app/datahistory`);
|
||||
const rawData = await response.json();
|
||||
// SELECT uuid, quantity, discount_percentage, price, currency, h_timestamp
|
||||
let historyData = rawData.map(d => ({
|
||||
@ -41,7 +40,7 @@ async function fetch_history() {
|
||||
async function fetch_item() {
|
||||
try {
|
||||
// SELECT uuid, itemid, skuid, choice, attributes, image
|
||||
const response = await fetch(`${currentUrl}/dataitem`);
|
||||
const response = await fetch(`${currentUrl}app/dataitem`);
|
||||
const rawData = await response.json();
|
||||
const items = rawData.reduce((item, row) => {
|
||||
const uuid = row[0];
|
||||
|
Loading…
x
Reference in New Issue
Block a user