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

Support programmatic usage of @decent/server better #289

Open
bates64 opened this issue Mar 5, 2018 · 2 comments
Open

Support programmatic usage of @decent/server better #289

bates64 opened this issue Mar 5, 2018 · 2 comments
Labels
discuss We should discuss this. server Affects the @decent/server package.

Comments

@bates64
Copy link
Collaborator

bates64 commented Mar 5, 2018

Currently, @decent/cli has to directly edit the database of the running server when commands are run. It'd be nice to allow require('@decent/server') consumers to pass some kind of object in with config and for it to export a nice programmatic API for them.

Thoughts?

@bates64 bates64 added server Affects the @decent/server package. discuss We should discuss this. labels Mar 5, 2018
@towerofnix
Copy link
Member

This would be nice, but probably hard to implement. We currently seriously rely on Express's middleware system, both for behavioral logic and dealing with errors/bad input. I'm not sure how to fake Express middleware accurately or how to fit this into our existing code nicely. I have an "evaluate middleware" function I made for the server tests, but it's certainly not an exact clone of how Express works; it's just there so we can test each middleware function as its own unit.

@bates64
Copy link
Collaborator Author

bates64 commented Mar 7, 2018

@towerofnix it would be fun to abstract the API more - eg. user.create function which is used by POST /api/users would be used both in the express code and also exported by @decent/server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discuss We should discuss this. server Affects the @decent/server package.
Projects
None yet
Development

No branches or pull requests

2 participants