itsthatguy / avatars-api-middleware

The express middleware for our avatars service
http://avatars.adorable.io
Other
749 stars 96 forks source link

module.exports missing #86

Closed agamemnus closed 5 years ago

agamemnus commented 5 years ago

idk

Needed to add module.exports = router; after var router = (0, _express2.default)(); in dist/routes/avatars.js.

rylnd commented 5 years ago

@agamemnus sorry for the late response; holidays and all that.

We've mainly been using this with babel and using import so we hadn't noticed the issue! It looks like what you're experiencing is described here.

Instead of modifying the source code, you should also be able to use:

var middleware = require('adorable-avatars').default;

Could you verify that when you have a moment?

I"m going to leave this open until we've fixed the issue; I believe something as simple as https://www.npmjs.com/package/babel-plugin-add-module-exports should do the trick.

agamemnus commented 5 years ago

I tried that and it didn't work, I think. I ended up just using your server code wholesale (maybe with a couple minor adjustments, like port number). Thank you for sharing this avatar generator!

agamemnus commented 5 years ago

But if I have time I will try it again.

rylnd commented 5 years ago

@agamemnus sure thing; I was playing with it in runkit and found that to be the case: https://runkit.com/rylnd/5c378920bc4c1d0013310b67

rylnd commented 5 years ago

@agamemnus as you probably saw, 0.2.2 was just released. The intention is that it should address this problem; please reopen the issue if it does not.