Code Monkey home page Code Monkey logo

Comments (7)

svenstaro avatar svenstaro commented on May 6, 2024

I suppose it would be pretty easy but can you just tell me your use case? The primary use of this tool is in its CLI usage. actix-web already has a listing for directories.

from miniserve.

whmountains avatar whmountains commented on May 6, 2024

My app needs to include basic file management features. I figured that it would be better all-round to send PRs to miniserve than to re-write from scratch. Some features I would need to send PRs for:

  • File uploads (I understand @boastful-squirrel is already working on this.)
  • Separate library from CLI. Maybe into separate crates?
  • I might send some PRs to improve the interface. Sorting columns, for example, unless someone is already working on that as well :)

from miniserve.

svenstaro avatar svenstaro commented on May 6, 2024

Sounds useful. Can you make a little proposal for how to split this up exactly? I suppose having a bin/ subdir with the actual miniserve CLI that links to the miniserve library would probably be alright considering that it likely won't blow up the project complexity too much.

I'd still like a proposal of what you'd move where before going forward on this.

from miniserve.

whmountains avatar whmountains commented on May 6, 2024

I would create a cargo workspace with two crates: miniserve and libminiserve.

miniserve would be responsible for parsing CLI arguments and setting up actix. libminiserve would expose a function similar to the current configure_app function to "attach" to your app. I would need to do some prototyping here but I expect it would take Box<App<impl MiniserveState>> and MiniserveConfig.

from miniserve.

svenstaro avatar svenstaro commented on May 6, 2024

How about a simpler version where you have only a single crate with this structure:

miniserve/src/{lib, other_lib_files}.rs, miniserve/src/bin/main.rs?

I think that would satisfy your need and still expose a binary.

from miniserve.

whmountains avatar whmountains commented on May 6, 2024

@svenstaro Okay, I can go that route if you prefer.

I won't be able to start work on this immediately, as I have another project to finish first. I will comment here when I start work on it.

from miniserve.

Nemo157 avatar Nemo157 commented on May 6, 2024

I also would love this for writing frontend tests. I need to spawn a simple server such as miniserve for the controlled browsers to hit, for now I'll probably try spawning miniserve as a sub-process, but being able to do it in process via a very simple miniserve::serve(...bind address, file path...) would be great.

from miniserve.

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.