mrchrisadams / flight-o-tron

A calculator for tracking cumulative emissions from aviation
Other
0 stars 0 forks source link

Add a nice way to save data #3

Open mrchrisadams opened 5 years ago

mrchrisadams commented 5 years ago

We have this janky approach where we just dump the JSON representation of trips onto the page.

Nicer would be to POST this to an API endpoint and get back a nice short key, like bongo-monk-zingo, or some other pronounceable key that users would use, or pass in as a GET param when loading, so you can share links to sets of travel.

you could use this to generate the words

https://github.com/evenbrenna/mngen

And as we're using HapiJS, using this ORM would mean we can use SQLite on something like glitch, but also use a differetn DB if need be too.

https://github.com/valtlfelipe/hapi-sequelizejs

mrchrisadams commented 5 years ago

Another option would be using some stuff here that also seem well documented and used in a bunch of projects

http://vincit.github.io/objection.js/

https://medium.com/@hapipal/building-real-world-apis-with-hapi-pal-c0303fcef1c6

Also, hapipal seems to be a nice set of defaults to follow for using hapi, if i'm gonna faff with serverside js

https://hapipal.com/best-practices/server-plugin-separation#the-joys-of-server--plugin-separation