4
\$\begingroup\$

I'm currently working on my thesis to obtain a bachelor in software engineering, and i want to get some feedback from real developers of how useful this project can be in the real life.

the project is two modules, one is the http server which i created from zero using the sockets library and it has support for GET, POST, PUT, DELETE, PATCH requests and the HEAD and OPTIONS requests and it publishes the API like uvicorn for FastAPI and in this you can create REST methods manually like in FastAPI or Flask, i havent implemented already an autodocumentation tool like Swagger but im currently working on it

the second part is the generator, for this you have to put your database host, password, db, etc and then you can generate the CRUD methods for every table in that database or for one or more specific tables

I'll attach an example of how it looks in code:

from server import Server, Http_status
from generator import Database, Generator

status = Http_status()

api = Server(HOST="127.0.0.1", PORT=4201)

db = Database(host="localhost"
              , port=3306
              , database="test_database"
              , username="user"
              , password="password"
              , db_type="mysql")

gen = Generator(debug=True)

api.router.add_router(gen.build_all(database=db, prefix="local", ask_for_methods=False, ask_for_tables=False))

api.router.add_router(app.routes)

api.run()

on this you generate the db object with the database authentication data and then you call the function build or build all on the gen object

the the data generated from this object can be attached to the main router of the server or can be added to other router and then added to the main router

in the routers can be added methods manualy too, here is how

def test_get(a1: int):
    print(a1)
    return {"a1":a1}, status.http_200()

api.router.add_get(function=app.test_get, url="test_get")

and that's kind of a resume of the project. I will appreciate any feedback.

\$\endgroup\$

1 Answer 1

4
\$\begingroup\$

working on my titulation project

Mi lengua materna es el ingles, but I'm afraid I don't know what the verb "to titulate" is all about. Nonetheless, I welcome you with open arms to our community. Wherever you have matriculated, I'm sure they are enriched by the presence of enthusiastic students. Ok, sorry, enough nit picking, I won't dwell on spelling details any longer. Thank you for offering up some code for review. The process makes the code stronger. Keep asking collaborators for their opinion; it will only make the code you write in coming weeks better and better.

comma comma code chameleon

              , port=3306

I get it, it's a thing. Minimizing git diffs is a noble goal. This seems more relevant for SQL syntax than for python, given that the interpreter will ignore trailing commas. (Mostly ignore, since (1,) != 1.) Some shops write down a style guide which mandates writing it in this way. I'm just going to say that that I won't work for such shops, and move on. I do thank you for being consistent. Well, ok, strcmp("localhost", "127.0.0.1") is non-zero, but that's a semantic thing, orthogonal to style details. Consider that IPv4 != IPv6.

test suite

status = ...
api = ...
api.router.add_router( ... )
api.router.add_router( ... )
api.run()

This seems to be pretty side-effect heavy. Please protect these statements with the usual guard.

if __name__ == '__main__':

Then a test suite can safely import this module and exercise its functions without worrying about unfortunate side effects.


It appears this project achieves its design goals.

I would be willing to delegate or accept maintenance tasks for it.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Hi, i know about the commas and the format it should have, i was focused on other things and i dont even noticed it haha, and thanks for your commentaries, im trying to get better at English and i dont use any transaltor so thats why some things can make no sense \$\endgroup\$ Commented May 20 at 20:48

Not the answer you're looking for? Browse other questions tagged or ask your own question.