S
stackoverflowuser95
I want to create a very simple set of HTTP endpoints in C or preferably C++.
Can you recommend a library/toolkit/framework providing similar conciseness of expression to this simple Python (Bottle) project?
from bottle import get, post, static_file, response, run
@get('/scripts')
def get_scripts():
# add code here to tar scripts folder(s)
return static_file("scripts.tar.xz", root='/path/to/scripts',
download="scripts.tar.xz")
@post('/scripts/new/<filename>')
def post_new_script(filename):
try:
# add code here to delete if exist then "post"/create script
except ValueError:
response.status = 400
return dict(error="Value error on script post")
# ^-- This is returned as JSON
if __name__ == '__main__':
run(host='localhost', port=8080) # Serve on a small web-server
Can you recommend a library/toolkit/framework providing similar conciseness of expression to this simple Python (Bottle) project?
from bottle import get, post, static_file, response, run
@get('/scripts')
def get_scripts():
# add code here to tar scripts folder(s)
return static_file("scripts.tar.xz", root='/path/to/scripts',
download="scripts.tar.xz")
@post('/scripts/new/<filename>')
def post_new_script(filename):
try:
# add code here to delete if exist then "post"/create script
except ValueError:
response.status = 400
return dict(error="Value error on script post")
# ^-- This is returned as JSON
if __name__ == '__main__':
run(host='localhost', port=8080) # Serve on a small web-server