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

Call Rest APIs from allcountjs #143

Open
bdqnghi opened this issue Dec 11, 2016 · 2 comments
Open

Call Rest APIs from allcountjs #143

bdqnghi opened this issue Dec 11, 2016 · 2 comments

Comments

@bdqnghi
Copy link

bdqnghi commented Dec 11, 2016

I have some existing Rest APIs that provide some information and I want to integrate Allcountjs with my APIs, how can I call it from inside an AllcountJS app?

@roginvs
Copy link

roginvs commented Mar 19, 2017

I solved this with hack:
First, I added into node_modules/allcountjs/core/index.js few lines:

//In the beginning
var request = require('request');
...
function configure() {
    .... 
    injection.bindFactory('Request', function () {
        return request;
    });

Then, in configuration file:

        beforeSave: function (Entity, Crud, Console, ValidationError, Request) {
          return new Promise(resolv => {
          Request.get('http://127.0.0.1:5555', x => {
            resolv();
          })
        })

@roginvs
Copy link

roginvs commented Mar 19, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants