fergiemcdowall / norch

A search server that can be installed with npm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to format data before use /add ?

wayearn opened this issue · comments

We need to format data and use the engine before the data add.

Is there anyway to do it?

You mean to get the data into JSON? Or to change the structure of existing JSON? Or something else?

Could you be more specific?

No, I have a JSON data need to format when use your /add api, like a Middleware:

norch().then({here's format data Middleware}).call('add',function(){})

I build a simple app use request, but I got proxy error:

    request.post({
      url: "http://localhost:3030/add",
      method: "POST",
      // json: true,   
      body: JSON.stringify(data),
      headers:{
        'Content-Type': 'application/json'
      }
    },function (error, response, body) {
      console.log('error:', error); // Print the error if one occurred
      console.log('statusCode:', response && response.statusCode); // Print the response status code if a response was received
      console.log('body:', body); // Print the HTML for the Google homepage.
    });

My app runs at localhost:3000, and norch runs at localhost:3030, got proxy error. But, when I use another host not localhost, like 127.0.0.2 to run norch, and my app runs at 127.0.0.1, my app works.

Hmmm- that sounds like you are experiencing network problems, but Norch is working?

Norch is working!