ffig icon indicating copy to clipboard operation
ffig copied to clipboard

Create Flask app with REST API

Open jbcoe opened this issue 8 years ago • 3 comments

A simple Flask http://flask.pocoo.org app could receive TU text (all includes included) and a list of bindings to produce and respond with generated code.

request:

{
  "translation_unit": "class A { int x_; public: int getX() const { return x_; } void setX(int x) { x_ = x; } };",
  "bindings": ["ruby", "python"],
  "module": "TestModule"
}

response:

{
  "TestModule.py" : " ... ",
  "TestModule.rb" : " ... ",
  "TestModule_c.cpp" : " ... ",
  "TestModule_c.h" : " ... "
}

jbcoe avatar Feb 02 '17 13:02 jbcoe

I want to start a separate repo, which will build on top of your docker image. That way I can specify a release tag and not be affected by ongoing development.

Thoughts?

petr-tik avatar Feb 02 '17 13:02 petr-tik

What are the pros and cons vs:

  1. a new repo?
  2. a fork of this repo?
  3. a branch?

I'd go for a branch by default.

jbcoe avatar Feb 02 '17 13:02 jbcoe

Not a fork - if starting a new repo, might as well start from scratch.

Happy to start a branch, let's tidy up the API and docker base image first and then I will get started

Thinking about rendering just 1 page with flask and then sending JS post requests with the translation unit. The max size of a post request will limit how big a header file we can process and I will need to warn the users.

Also we can use client-side javascript to check headerfile for malicious code by keywords like cgroup. IIRC, cgroup is the kernel module that docker uses. I don’t know how exactly accessing cgroups inside a container can lead to privelige escalation, but it feels like a reasonable first attempt at security.

petr-tik avatar Feb 02 '17 14:02 petr-tik