monumentum / astronode

Exporting mongoose model as rest endpoints :metal:
GNU General Public License v3.0
6 stars 1 forks source link

Create adapter logic #3

Open guidiego opened 6 years ago

guidiego commented 6 years ago

Problem Today we are able to inject any kind of server library (restfy, express, koa) inside newServer function, but the code was developed using only express interface

What you need to do Im open to discussions about this, but basically, we need to create an adapter layer to change theattachController` logic once that we pass a different kind of library to do the server.

My opinion: I think in create submodules as: restoose-express, restoose-koa .... and make something like:

const express = require('restoose-express') // this will contain logic to init the app and mapping the controller

References: https://github.com/guidiego/restoose/blob/master/example/express/index.js#L6 https://github.com/guidiego/restoose/blob/master/restoose/utils/attachControllers/index.js

guidiego commented 6 years ago

Updating:

Now we need to create a plugin logic, something to be pluggable in astronode configuration