bananaoomarang / isomorphic-redux

Isomorphic Redux demo, with routing and async actions
https://medium.com/@bananaoomarang/handcrafting-an-isomorphic-redux-application-with-love-40ada4468af4
MIT License
455 stars 87 forks source link

Run API on my computer #50

Closed devtud closed 8 years ago

devtud commented 8 years ago

How can I run the API server on my computer and on my local database instead of https://webtask.it.auth0.com/api/run/wt-milomord-gmail_com-0/redux-tutorial-backend?webtask_no_cache=1 ?

bananaoomarang commented 8 years ago

The code (simple express app) used is here: https://github.com/bananaoomarang/isomorphic-redux/blob/master/redux-tutorial-backend.js.

You will just need to remove the webtask require at the top and the module.exports line at the bottom. Install the required modules and add app.listen(<port>, cb) to start the express app.

devtud commented 8 years ago

I did so but it crashes in app.post for example

var MONGO_URL = req.webtaskContext.data.MONGO_URL;

because req does not contain webtaskContext key.

bananaoomarang commented 8 years ago

Ah, yes, sorry. You will have to set up a mongo database somewhere for that url to point to.

I was using a free one from mlab, but you could use a local one too.