Git Product home page Git Product logo

fastify-esm-loader's Introduction

fastify-esm-loader's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

fastify-esm-loader's Issues

Prefixing recursive routes

It will be much convenient to be able to prefix a recursive route instead to have to write the whole path for each endpoint:

// /server/routes/index.js
export default ({ fastify, self }) => {
    // Being able to register recursive routes s plugins for example
    fastify.register(require("./v1"), { prefix: "/v1" });
    fastify.register(require("./v2"), { prefix: "/v2" });
};

So the recursive routes can be written "relatively" not "absolutely"

// /server/routes/v1/index.js
export default ({ fastify, self }) => {
  fastify.get("/", self.name); // points to /api/v1/
  // Instead of this
  // fastify.get("/v1", self.name);
  // providing the whole path, which will become much longer with more folders recursively 
};

PS:

  • This example is based on the default example
  • I tried this method hoping register would work but it did not.

Thank you

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.