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
|
||||||
|
flask-cors
|
||||||
gunicorn
|
gunicorn
|
||||||
psycopg2-binary
|
psycopg2-binary
|
||||||
requests
|
requests
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
from flask import Flask, request, jsonify
|
from flask import Flask, request, jsonify
|
||||||
|
from flask_cors import CORS
|
||||||
import requests, re, json, os, yaml
|
import requests, re, json, os, yaml
|
||||||
from db import *
|
from db import *
|
||||||
from aliexpress import *
|
from aliexpress import *
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
CORS(app)
|
||||||
|
|
||||||
def get_conf():
|
def get_conf():
|
||||||
'''return settings in settings.yaml file'''
|
'''return settings in settings.yaml file'''
|
||||||
|
@ -13,7 +13,6 @@ const width = window.innerWidth - margin.right - margin.left -10;
|
|||||||
|
|
||||||
// url
|
// url
|
||||||
const currentUrl = window.location.href;
|
const currentUrl = window.location.href;
|
||||||
console.log(currentUrl);
|
|
||||||
|
|
||||||
|
|
||||||
// reload page when window is resized
|
// reload page when window is resized
|
||||||
@ -22,7 +21,7 @@ window.onresize = function(){ location.reload(); }
|
|||||||
|
|
||||||
async function fetch_history() {
|
async function fetch_history() {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${currentUrl}/datahistory`);
|
const response = await fetch(`${currentUrl}app/datahistory`);
|
||||||
const rawData = await response.json();
|
const rawData = await response.json();
|
||||||
// SELECT uuid, quantity, discount_percentage, price, currency, h_timestamp
|
// SELECT uuid, quantity, discount_percentage, price, currency, h_timestamp
|
||||||
let historyData = rawData.map(d => ({
|
let historyData = rawData.map(d => ({
|
||||||
@ -41,7 +40,7 @@ async function fetch_history() {
|
|||||||
async function fetch_item() {
|
async function fetch_item() {
|
||||||
try {
|
try {
|
||||||
// SELECT uuid, itemid, skuid, choice, attributes, image
|
// 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 rawData = await response.json();
|
||||||
const items = rawData.reduce((item, row) => {
|
const items = rawData.reduce((item, row) => {
|
||||||
const uuid = row[0];
|
const uuid = row[0];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user