SnapSearch / SnapSearch-Client-Node

Node.js HTTP Client Middleware Library for SnapSearch. Search engine optimisation for single page applications.
https://snapsearch.io
MIT License
5 stars 5 forks source link

Loopback Server #3

Open mohammadmortazavi87 opened 7 years ago

mohammadmortazavi87 commented 7 years ago

Hi. I have a question about the component. We use Loopback for server side, and Loopback works with Node.Js. Is this component working on this conditional? https://loopback.io/

CMCDragonkai commented 7 years ago

Hi,

It can work in any node environment. If it supports connect middleware, you can use the connect API, but if it doesn't you just have to look for the front controller index, and hook it in where it is appropriate.

I would need to see how you're setting up your index.js to give further advice.

Thanks, Roger

On 1 Jul 2017 23:21, "mohammadmortazavi87" notifications@github.com wrote:

Hi. I have a question about the component. We use Loopback for server side, and Loopback works with Node.Js. Is this component working on this conditional? https://loopback.io/ http://url

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/SnapSearch/SnapSearch-Client-Node/issues/3, or mute the thread https://github.com/notifications/unsubscribe-auth/AAnHHQEP4PGxwjIwYVSS6jcAtHZvFNiCks5sJkf0gaJpZM4OLUD3 .

mohammadmortazavi87 commented 7 years ago

Thanks for your responding. do I have to use this at the middleware? I used the code at my server.js like this.

`var loopback = require('loopback'); var boot = require('loopback-boot'); var app = module.exports = loopback(); var snapsearch = require('snapsearch-client-nodejs'); app.middleware('parse:before', multer({ dest: 'temp/' }).single('image')) app.start = function() { return app.listen(function() { app.emit('started'); var baseUrl = app.get('url').replace(/\/$/, ''); console.log('Web server listening at: %s', baseUrl); if (app.get('loopback-component-explorer')) { var explorerPath = app.get('loopback-component-explorer').mountPath; console.log('Browse your REST API atnode . %s%s', baseUrl, explorerPath); } app.get('/', function (request, response,next) { // response.send('Was not a robot and we are here inside app'); next();

});

}); };`

CMCDragonkai commented 7 years ago

You could try calling snapsearch inside the middleware call, as that appears to be a way to integrate generic middleware into loopback.

On 2 Jul 2017 00:13, "mohammadmortazavi87" notifications@github.com wrote:

Thanks for your responding. do I have to use this at the middleware? I used the code at my server.js like this. `var loopback = require('loopback'); var boot = require('loopback-boot'); var app = module.exports = loopback(); var snapsearch = require('snapsearch-client-nodejs'); app.middleware('parse:before', multer({ dest: 'temp/' }).single('image')) app.start = function() { return app.listen(function() { app.emit('started'); var baseUrl = app.get('url').replace(//$/, ''); console.log('Web server listening at: %s', baseUrl); if (app.get('loopback-component-explorer')) { var explorerPath = app.get('loopback-component-explorer').mountPath; console.log('Browse your REST API atnode . %s%s', baseUrl, explorerPath); } app.get('/', function (request, response,next) { // response.send('Was not a robot and we are here inside app'); next();

});

}); };`

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/SnapSearch/SnapSearch-Client-Node/issues/3#issuecomment-312434343, or mute the thread https://github.com/notifications/unsubscribe-auth/AAnHHdtPbfdfUhaKBt8yitXnSXr0GFYjks5sJlP9gaJpZM4OLUD3 .

mohammadmortazavi87 commented 7 years ago

Thanks for your responding. As I mentioned before, I used the codes and It worked in localhost. When I uploaded it, the website did not work. Do you have any idea for this problem? We use React for client side and loopback for server side.

Thanks

CMCDragonkai commented 7 years ago

Without more information, there's not much I can debug for you here.

On 12 Jul 2017 00:15, "mohammadmortazavi87" notifications@github.com wrote:

Thanks for your responding. As I mentioned before, I used the codes and It worked in localhost. When I uploaded it, the website did not work. Do you have any idea for this problem? We use React for client side and loopback for server side.

Thanks

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/SnapSearch/SnapSearch-Client-Node/issues/3#issuecomment-314456154, or mute the thread https://github.com/notifications/unsubscribe-auth/AAnHHdgorefAFdL5NW7AmBbc8KXpQSwWks5sM4JVgaJpZM4OLUD3 .