Code Monkey home page Code Monkey logo

Comments (5)

bidhan-a avatar bidhan-a commented on June 18, 2024 1

Hi @arnaudbesnier ,

I was referring to this block of code inside app.js:

fs.readdirSync('./routes').forEach((file) => {
  if (file !== '.gitkeep') {
    app.use('/forest', require('./routes/' + file));
  }
});

The app is already "using" '/forest' here, so I think defining our routes as just '/brands' instead of '/forest/brands' would work fine.

from forest-express.

arnaudbesnier avatar arnaudbesnier commented on June 18, 2024

Hi @bidhan-a, we'd love to help you. But we need you whole Smart Collection implementation to check that everything looks good.

It might also be one of your express project middleware that could respond 404ย before hitting the custom route you created.

from forest-express.

bidhan-a avatar bidhan-a commented on June 18, 2024

Hello @arnaudbesnier ,

Thanks for the response. I've actually managed to resolve this issue. I was following along with the documentation on how to define a custom GET route. It mentions the following:

router.get('/forest/brands', Liana.ensureAuthenticated, function (req, res) {...})

But it doesn't work that way. It should only be

router.get('/brands', Liana.ensureAuthenticated, function (req, res) {})

because '/forest' is already defined inside app.js.

from forest-express.

arnaudbesnier avatar arnaudbesnier commented on June 18, 2024

Thanks @bidhan-a ! Cool to see that you made it work.

I don't really understand why the route declaration:
router.get('/forest/brands', Liana.ensureAuthenticated, function (req, res) {...})
does not work as described in the documentation.

What do you mean, saying "'/forest' is already defined inside app.js"?

from forest-express.

arnaudbesnier avatar arnaudbesnier commented on June 18, 2024

@bidhan-a I finally understood your point... Seems to make sense.
I didn't get that you used Lumber to generate your project.

We need to improve the doc about this.

from forest-express.

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.