sw-jobs-api/api/api.py
ChrQR 7049dcc992
Some checks are pending
Build and Push Docker Images / build (push) Waiting to run
initial commit
2024-05-29 23:28:58 +02:00

21 lines
443 B
Python

from flask import Flask, jsonify
import json
import os
app = Flask(__name__)
# Path to your JSON file
db_file = os.path.join('scrapers', 'jobs_db.json')
@app.route('/api/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(debug=False, host='0.0.0.0')