ProjectSakura / Mirai

A website to stream Anime and read Manga for free.. Everything is scraped from sources online and we don't need to actually host any videos or images.
Other
46 stars 30 forks source link

Modular code needed #2

Open ArunTeltia opened 3 years ago

ArunTeltia commented 3 years ago

There is a need of making the code modular. like putting all the anime streaming route in one folder, loader in one folder and manga reader in one folder

singhayushh commented 3 years ago

I am willing to take up this issue.

I have another suggestion regarding the code modularity. Currently the controller functions for each of the routes are written right inside the route definition. Example:

router.get("/", function (req, res, next) {
  request(
    "https://www.gogoanime1.com/search/topSearch?q=" + req.query.q,
    (error, response, html) => {
      res.send(response.body);
    }
  );
});

A good convention to follow is to create a controllers/ directory and have all these controller functions (let's call the above handler function as topSearchHandler) in there so that the api end point just has to call the function:

router.get("/", topSearchHandler)
ArunTeltia commented 3 years ago

Yeah sounds reasonable, can you create an issue for this as well so that we don't forget the main aim if this issue. If you want to work on this issue, you can break this issue into parts as this is one of the epic issue that require many files to get changed Assigning this issue to you

singhayushh commented 3 years ago

Thank you. I'll do that.

Also, there a typo in the issue label refractor should be refactor I guess. 😅

ArunTeltia commented 3 years ago

Yeah Removed