Please update DynamoDB docs/examples


#1

Right now the dynamoDB example uses hyperweb instead of express which is default for new projects.
There needs to be some clarification of what hyperweb is and why I need that for the datastore.js (from example). Also it seems like I dont need it for async calls?
I wanted to use express with sync calls from datastore.js but I ran into strange errors that appeared on some deployments but not all. ("…defer can’t be used without Fiber")

Is there a way to reliably use express with sync calls from datastore.js? Maybe datastore.js from the example needs an update to be used with express?


#2

Hyperweb just bundles a few things, including Express, and can be used the same as Express. You can see what else it includes at: https://github.com/FogCreek/hyperweb-init/blob/master/package.json. But you’re right, since we’re moving away from that approach I’ve updated our examples.

You shouldn’t encounter the Fiber issues if you’re using it with Express as used in the example project. Make sure you only initialize the datastore after setting up the Express server. To get around the Fiber issue if your project doesn’t use Express at all, then you can just use var sync = require("synchronize"); and then you always have to wrap the function that uses the (sync) datastore this way: sync.fiber(function () { /* function body */ }).

The async datastore can always be used without that, but it uses Promises so it’s a bit trickier to use. Here’s an example without Hyperweb, using async.


#3

Here’s an example of using datastore.js without Hyperweb using Express: https://hyperdev.com/#!/project/linen-hunter


#4

hey,

Just updating this thread with a note that DynamoDB support is being deprecated with an upcoming infrastructure update. The short reason why is that we don’t feel like it’s a user-friendly or maintainable solution going forward.

here’s a longer explanation

For that reason, we’ll be removing the datastore.js examples from the community site. But there’s lots of other great examples there using other db services.

We recommend that you use a third party db as a service like mlab, heroku postgres, or redis-cloud instead.

thx!