Coder Social home page Coder Social logo

Routing considerations about lilac HOT 3 CLOSED

HalfdanJ avatar HalfdanJ commented on June 1, 2024
Routing considerations

from lilac.

Comments (3)

nsthorat avatar nsthorat commented on June 1, 2024

Some context about how things work right now:

If you spin up a server and go to "/docs" you'll see the OpenAPI spec exposed by the FastAPI server
image

We use an OpenAPI => TypeScript fetch() compiler from this script which generates all the code in fastapi_client. This is done in the dev server whenever python code is touched (so the typescript hot loader automatically kicks in). What's really nice is we type the FastAPI rest endpoints with pydantic models, which basically act as a very lightweight proto, and it generates the TypeScript interfaces on the other side.

For example:
Python: https://github.com/lilacai/lilac/blob/main/src/router_data_loader.py#L68
Auto-gen'd typescript:


Our RTK Query wrapped endpoint which components actually call:
loadDataset: builder.mutation<

The python server speaks OpenAPI which is really nice because we can generate clients for any language: https://github.com/OpenAPITools/openapi-generator

Is there something that Next.js could give us beyond this?

from lilac.

HalfdanJ avatar HalfdanJ commented on June 1, 2024

Ok i see, makes more sense now. Is /tasks intentionally left outside the api, or just not ported over? That was the one that was fooling me. Same goes with the other routes in server.py.

from lilac.

nsthorat avatar nsthorat commented on June 1, 2024

Ah yeah, everything in server.py is a bit old (for the original prototype). We'll clean this up as soon as the new concept builder rough draft is done, we were just keeping that around in case we wanted to look at it. But yeah, everything in server should get prefixed!

from lilac.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.