datopian / frontend-v2

CKAN / Data Portal frontend as microservice in pure Javascript (Node).
http://tech.datopian.com/frontend/
MIT License
38 stars 18 forks source link

Can routes and and i18n configuration be customized? #176

Open sabinem opened 4 years ago

sabinem commented 4 years ago

We are currently developing a theme for this frontend.

What we struggle with is the following:

These are questions on customization of this repo. Hope it is appropriate to ask them here.

EvgeniiaVak commented 4 years ago

@sabinem

About routing customization - it depends. You can see the order in which controllers are declared in main index.js, the /dataset is declared here https://github.com/datopian/frontend-v2/blob/master/index.js#L110-L112 - after the theme, so this this endpoint should be easily overridable by your theme code. Plugins however are loaded before the theme, so they will take precedence.
Here is an overview of the request flow - http://tech.datopian.com/frontend/#design-how-it-works

Although probably you might even not need the custom routing - only custom html - you can just create a new view in your theme - it will override the default.


i18n files are pretty static already. They are indeed updated when meeting a new translatable string, but once all of new strings are filled in to the JSON files, they won't be updated. Currently i18n library is used to handle the translations.

sabinem commented 4 years ago

@EvgeniiaVak

Thanks so much for getting back to me on this.

I get your point on the internationalization. I think we can live with that.

The routes are a different topic: All of our routes are custom for historical reasons: we just need to rebuild an existing application and preserve all urls. What would help me most in this regard, would be a configuration option in the .env to disable all standard routes:

  //app.use([
  //  dmsRoutes()
  //]) 

What do you think about such a configuration option? Would that work for you? Can I help in any way to make this possible (by providing a PR for example)?

EvgeniiaVak commented 4 years ago

@sabinem Making the app more configurable sounds ok to me, as long as the old behavior is not changed.

@anuveyatsu @starsinmypockets What do you think? Would it be ok to have configuration option disabling DMS routes? Maybe we could also make plugin routes optional too?

anuveyatsu commented 4 years ago

@sabinem @EvgeniiaVak I'm not sure if disabling all core routes would be helpful. In that case why not to build an Express app from scratch as I think there will be very little benefit of using this library?

Re plugins, the controllers are only enabled when you add a plugin into your config file afaik.