A tiny web-server app with a configuration file, NO NEED TO CODE
This project is a small webserver that just have to get a port and a configuration file to perform preconfigurated commands.
This was a test-research project for a specific user-case on my raspberry-pi, therefore, i configurated only two methods (GET and POST)
You just have to run :
pip install dycow
$ dw -h
[-] dycow v0.0.9.7.
[-] Help center !
[x] Run : dw <port> <conf-file>
[x] Documentation online https://github.com/sanix-darker/dycow
You have to create a file, for example conf
and set actions, for example :
- GET
(or - POST
) is the type of the request, just after it the endPoint (/save
, /callme?name&content
).
cmd
is the command line that will be executed on a request.
res
[NOT REQUIRED] is the response to the request.
var
is to specify POST variables. \
Variables like #content#
means, the content variable will be replace with the input value as parameter.
# dw <port> <configuration-file>
dw 3000 conf
It will start a small server on port 3000
and following rules you specified in the configuration file.
To run rest-api tests, i made a bash file in ./tests
directory.
you just have to run bash ./tests/rest-api-test.sh
$ bash ./tests/rest-api-test.sh
[-] Running Endpoints tests on dycow.
[✓] GET / passed.
[✓] GET /list passed.
[✓] GET /callme?name=darker passed.
[✓] POST /save passed.
- - -
[-] Tests run :
[-] 4 tests succeed !
[-] 0 tests failed !
[-] Stopping tests Endpoints on dycow.