Christian
bc67482b24
Some checks failed
Build and Push Docker Images / build (push) Failing after 11s
24 lines
588 B
Python
24 lines
588 B
Python
from flask import Flask, jsonify
|
|
import json
|
|
import os
|
|
|
|
app = Flask(__name__)
|
|
|
|
# Path to your JSON file for production
|
|
db_file = os.path.join('scrapers', 'jobs_db.json')
|
|
|
|
# Path to db JSON file for development
|
|
#db_file = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'scrapers', 'jobs_db.json')
|
|
|
|
@app.route('/jobs', methods=['GET'])
|
|
def get_jobs():
|
|
if os.path.exists(db_file):
|
|
with open(db_file, 'r') as file:
|
|
jobs = json.load(file)
|
|
else:
|
|
jobs = []
|
|
return jsonify(jobs)
|
|
|
|
if __name__ == '__main__':
|
|
app.run(host='0.0.0.0', port=5000)
|