To proxy requests to solr in ExpressJS, you can use the HTTP proxy:
npm install express-http-proxy --save
When you set this up, you can add the core (here called new_core), and any arguments you want added by default:
var proxy = require('express-http-proxy');
app.use('/execute',
proxy('http://localhost:8983', {
forwardPath: function(req, res) {
return '/solr/new_core/select?wt=json&indent=true&' +
require('url')
.parse(req.url)
.path
.substring('execute/'.length);
}
}
));
This will pass anything that goes to “/execute” to your Solr core.