/powerplant-coding-challenge

Challenge for applicants that desire to join our team

Primary LanguagePython

Install Python 3 (Python 3.7.3 used in this app)

python.org

Clone repository

$ cd path/to/where/you/want/it
$ git clone https://github.com/wiggoen/powerplant-coding-challenge.git

REST API

REST: REpresentational State Transfer

API: Application Programming Interface

JSON: JavaScript Object Notation

Flask

Flask

HTTP Request methods

HTTP request methods

The application

Make the virtual environment

$ cd powerplant-coding-challenge
$ python3 -m venv venv
$ source venv/bin/activate

Install requirements

$ pip3 install -r requirements.txt

Running the application

$ python3 app.py

POST request

In a new terminal:

$ cd powerplant-coding-challenge
Format of CURL request
$ curl --request POST --header "Content-Type: application/json" --data "@path/to/filename.json" http://localhost:port/endpoint

-X or --request
-H or --header

For example:
$ curl -X POST -H "Content-Type: application/json" --data "@example_payloads/payload1.json" http://127.0.0.1:8888/productionplan

Exit the application

CTRL + C

Leave the virtual environment

$ deactivate