OriginProtocol / origin-bridge

We've moved to a monorepo: https://github.com/OriginProtocol/origin/tree/master/infra/bridge
MIT License
15 stars 7 forks source link

Indexing API endpoints #91

Closed tyleryasaka closed 6 years ago

tyleryasaka commented 6 years ago

Couple adjustments:

  1. Indexing endpoints should be in their own namespace. So /api/listings should be something like /api/indexing/listings.

  2. Endpoints for listing multiple resources should be plural, following REST conventions (/api/indexing/listing should be /api/indexing/listings.) (EDIT: this isn't too important either way)

ambertch commented 6 years ago

If we pluralize the endpoint names: the tables in the database are also in the singular, so it could be an option to pluralize those as well.

tomlinton commented 6 years ago

I think the dapp will start using these endpoints in the near future so I'll take this on. Anyone else have any thoughts about the table names being pluralized as @ambertch suggested? I prefer them pluralized, it makes writing queries feel more natural, e.g. select * from listings instead of select * from listing (not that writing raw SQL is going to happen very often).

franckc commented 6 years ago

Personally I'm slightly in favor of singular for database tables. Mostly because I'm used to that convention. But also it is a bit shorter and plural makes me think it is a collection that is stored (vs individual items). We currently use singular in our origin-bridge and origin-website repos. There are long debates on the internet about this and people have different opinions ! :) Overall, I don't think it really matters which way we go as long as we are consistent in our naming convention for all tables.

Also, as a pointer, the indexing APIs are currently defined via Flask Restless here. Since Flask restless provides a way to name an endpoint differently from the table name, in case we stick with singular for table names we could still expose plural REST endpoints.

tomlinton commented 6 years ago

Agreed that it doesn't really mattter as long as it is consistent @franckc. :+1: I'll just do the URL changes for now.

tomlinton commented 6 years ago

Closing this as origin-bridge will no longer handle indexing.