Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KOA Support #226

Closed
LucianoGanga opened this issue Jan 20, 2016 · 12 comments
Closed

KOA Support #226

LucianoGanga opened this issue Jan 20, 2016 · 12 comments
Labels

Comments

@LucianoGanga
Copy link

Hi!

I've been using this module in an express server. Now, I'm making a new app using KOA, but I'll like to keep using this.
Is it possible to find an easy way to implement this module in KOA?

I know that the name is express-restify-mongoose, but maybe someone here already made the solution.

I found this https://github.com/pixel2/koa-restify-mongoose repo, but it's not very updated.

Thanks!

@Zertz
Copy link
Collaborator

Zertz commented Jan 21, 2016

I am not familiar with Koa, but if there's a straightforward way to support it, I am open to a PR and I'm sure @florianholzapfel would be as well.

@Zertz
Copy link
Collaborator

Zertz commented Jan 21, 2016

Also, this project has been updated since that fork, but it's mostly refactoring. The core is very similar.

@LucianoGanga
Copy link
Author

Thanks @Zertz . I'll be checking this next week (I have to finish some tasks first), and if I can make any change to support it straightforward, I'll be posting here again with a PR.
Meanwhile, if someone has any idea on what things I have to keep in mind to do this, that will be awesome.

@Zertz Zertz reopened this Jan 21, 2016
@Zertz Zertz added the question label Feb 5, 2016
@LucianoGanga
Copy link
Author

@Zertz, @florianholzapfel , I made my own repository with the KOA support. The thing is that I had to rewrite all the middlewares and all the parts of the code that used express, so I couldn't do a fork and I just cloned it.
This is the URL: https://github.com/LucianoGanga/koa-restify-mongoose

I need it for my project, so I'd like to make it an npm module and publish it.

If you guys allow me to do that, I'd really appreciate it. Besides that, of course I'd put a reference to your repository.

About the functionality, I had to remove the private fields functionality, and a postMiddleware.

The code is not as tidy as I'd like right now, but I'll like to arrange it better in the next weeks. The thing is that I need it now for my project, so I was in a rush to finish it.

I'll be waiting for your answer to publish the npm module if you let me.

Thanks!
Luciano

@Zertz
Copy link
Collaborator

Zertz commented Feb 10, 2016

Good work! I like what you've done with normalizeMiddleware, cleans up the main file nicely. Just a suggestion, you should probably run our tests against your code to make sure no bugs were introduced.

It's MIT licensed so you are free to "use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software". Attribution is of course appreciated :)

@Zertz Zertz closed this as completed Feb 10, 2016
@LucianoGanga
Copy link
Author

Nice! Thanks you Zertz!

I just couldn't let the code to be messy like that and now I'm trying to do the things right with a fork from your repo. It's quite hard for me because it's my first time doing this, but I'll try the best :)

Also, I'll be integrating the tests soon, and babel, like you have in your code, as we share a few files and I don't want to loose your upgrades (maybe I can merge a few files of you when you update them)

I'll let you know here when I finish this, so other people can use this too.

Thanks!
Luciano

@Zertz
Copy link
Collaborator

Zertz commented Feb 10, 2016

Awesome! It's great to have new people in open source :)

I would recommend you fork this repository and modify that instead of making a new one from scratch. This would make your life easier if you want to keep up to date with the changes in this repo.

@LucianoGanga
Copy link
Author

Here it is!
GitHub: https://github.com/LucianoGanga/koa-restify-mongoose

NPM: https://www.npmjs.com/package/koa-restify-mongoose

I have to test it more now, but it should work the same way than yours. I added the access functionality for fields too, so the only thing missing is the postMiddleware and adapt the test and examples to KOA. I'll do it when I have the time.

Thanks @Zertz !

@Zertz
Copy link
Collaborator

Zertz commented Feb 11, 2016

You're welcome, let us know if you have questions related to the code

@florianholzapfel
Copy link
Owner

@LucianoGanga Great work!

@LucianoGanga
Copy link
Author

Thanks @florianholzapfel !

@Zertz , now that you mention, I do have a question. Why did you remove the "plural" functionality in the code?

Cheers!

@Zertz
Copy link
Collaborator

Zertz commented Feb 12, 2016

See #234 and inflection is limited to English

@jpravetz jpravetz mentioned this issue Feb 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants