File tree 4 files changed +57
-8
lines changed 4 files changed +57
-8
lines changed Original file line number Diff line number Diff line change 1
- CoderBot
2
- ========
1
+ # CoderBot
3
2
4
- A RaspberryPI-based bot controller
3
+ A RaspberryPI-based programmable robot for educational purposes. Check the [ project website ] ( https://coderbot.org ) for more information.
5
4
6
- The module provide a simple web interface to a raspberry py "robot" .
5
+ For further information about development and technical documentation, see the [ Wiki ] ( https://github.com/CoderBotOrg/coderbot/wiki ) .
7
6
8
- See the [ wiki ] ( https://github.com/CoderBotOrg/coderbot/wiki ) for the documentation
7
+ This repository contains the backend, along with some configuration applied on the base system image.
9
8
9
+ ### Quickstart
10
10
11
+ ``` bash
12
+ git clone https://github.com/CoderBotOrg/coderbot.git
13
+ cd coderbot
14
+ python3 -m venv .
15
+ source bin/activate
16
+ pip3 install -r requirements.txt
17
+
18
+ # Start the backend in stub mode
19
+ PYTHONPATH=stub python3 init.py
20
+
21
+ # or, run the real thing if you're on a physical RPi
22
+ python3 init.py
23
+ ```
24
+
25
+ The legacy API and frontend application is available at ` localhost:5000 ` .
26
+
27
+ The new API is at ` localhost:5000/v2 ` , while the new application is served at ` localhost:5000/vue ` (assuming the [ vue-app] ( https://github.com/coderbotorg/vue-app ) build is placed in the ` dist/ ` folder).
28
+
29
+ To see the dynamic documentation of the new API, clone the [ swagger-ui] ( https://github.com/coderbotorg/swagger-ui ) repository inside the ` coderbot/ ` folder and it'll be live at ` localhost:5000/v2/ui/index.html ` .
11
30
Original file line number Diff line number Diff line change @@ -32,11 +32,19 @@ def turn(data):
32
32
def status ():
33
33
return "ok"
34
34
35
+ def list (data ):
36
+ return json .dumps (prog_engine .prog_list ())
37
+
35
38
def exec (data ):
36
39
prog = prog_engine .create (data ["name" ], data ["code" ])
37
40
return json .dumps (prog .execute ())
38
41
39
42
def save (data ):
40
43
prog = Program (data ["name" ], data ["code" ], data ["dom_code" ])
41
44
prog_engine .save (prog )
42
- return "ok"
45
+ return "ok"
46
+
47
+ def load (data ):
48
+ prog = prog_engine .load (data ["id" ])
49
+ return jsonify (prog .as_json ())
50
+
Original file line number Diff line number Diff line change 56
56
connexionApp = connexion .App (__name__ , swagger_ui = True , swagger_path = 'swagger-ui/' )
57
57
# We serve a custom version of the swagger ui (Jinja2 templates) based on the default one
58
58
59
- # New API is defined in swagger .yml and api.py
60
- connexionApp .add_api ('swagger .yml' )
59
+ # New API is defined in v2 .yml and its methods are in api.py
60
+ connexionApp .add_api ('v2 .yml' )
61
61
62
62
63
63
# Connexion wraps FlaskApp, so app becomes app
Original file line number Diff line number Diff line change @@ -12,10 +12,30 @@ basePath: "/v2"
12
12
13
13
# Paths supported by the server application
14
14
paths :
15
+ /list :
16
+ get :
17
+ operationId : " api.list"
18
+ summary : " Get the list of all the saved programs"
19
+ tags :
20
+ - Program management
21
+ responses :
22
+ 200 :
23
+ description : " ok"
24
+ /load :
25
+ get :
26
+ operationId : " api.load"
27
+ summary : " Get the program with the specified ID"
28
+ tags :
29
+ - Program management
30
+ responses :
31
+ 200 :
32
+ description : " ok"
15
33
/save :
16
34
post :
17
35
operationId : " api.save"
18
36
summary : " Save a new program"
37
+ tags :
38
+ - Program management
19
39
parameters :
20
40
- in : body
21
41
name : data
28
48
post :
29
49
operationId : " api.exec"
30
50
summary : " Execute the given program"
51
+ tags :
52
+ - Program management
31
53
parameters :
32
54
- in : body
33
55
name : data
You can’t perform that action at this time.
0 commit comments