Get local development setup working

pull/21/head
Christoph Lienhard 3 years ago
parent 0e4299b8ed
commit aaec295ba4
  1. 1
      .editorconfig
  2. 2
      backend/README.md
  3. 8
      backend/flask-server/main.py
  4. 3
      redaktions-app/README.md
  5. 814
      redaktions-app/package-lock.json
  6. 3
      redaktions-app/package.json
  7. 2
      redaktions-app/src/App.tsx
  8. 2
      redaktions-app/src/components/ExistingQuestions/ExistingQuestions.tsx

@ -6,6 +6,7 @@ indent_style = space
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_size = 2
[*.py]
indent_size = 4

@ -18,7 +18,7 @@ Start the flask server locally under http://127.0.0.1:5000 with the follwing scr
```
./dev-start.sh
```
Observe dummy data for http://127.0.0.1:5000/kandidaten
Observe dummy data for http://127.0.0.1:5000/api/kandidaten
#### For Windows
```set set FLASK_APP=flask-server/main.py```

@ -3,24 +3,24 @@ from flask import Flask
app = Flask(__name__)
@app.route('/')
@app.route('/api/')
def root():
return "Candymat Data Backend"
@app.route('/fragen')
@app.route('/api/fragen')
def fragen():
with open('data/fragen.json', 'r') as json_file:
return json_file.read()
@app.route('/kandidaten')
@app.route('/api/kandidaten')
def kandidaten():
with open('data/kandidaten.json', 'r') as json_file:
return json_file.read()
@app.route('/kategorien')
@app.route('/api/kategorien')
def kategorien():
with open('data/kategorien.json', 'r') as json_file:
return json_file.read()

@ -10,6 +10,9 @@ Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
The page will reload if you make edits.<br>
You will also see any lint errors in the console.
Running the app without the backend server makes little sense.
Start it under [http://localhost:5000](http://localhost:5000) as specified in the Readme of the backend server (../backend)
### `npm test`
Launches the test runner in the interactive watch mode.<br>

File diff suppressed because it is too large Load Diff

@ -35,5 +35,6 @@
"last 1 firefox version",
"last 1 safari version"
]
}
},
"proxy": "http://localhost:5000"
}

@ -6,7 +6,7 @@ import { CustomAppBar } from 'components/CustomAppBar/CustomAppBar';
import { Overview } from 'components/Overview/Overview';
export const dataApi = 'http://127.0.0.1:5000'
export const dataApi = '/api'
const styles = createStyles({

@ -38,7 +38,7 @@ class ProtoExistingQuestions extends React.PureComponent<ExistingQuestionsProps,
}
componentDidMount() {
fetch(`${dataApi}/fragen/neu`, {method: 'GET'})
fetch(`${dataApi}/fragen`, {method: 'GET'})
.then(res => res.json())
.then(json => this.setState({ existingQuestions: json }))
}

Loading…
Cancel
Save