I created below sample server.js and in this I want server to load default index.html at http:localhost:3000/public but it is loading route "/products/?query" at above path, please let me know where i am wrong in implementing.
var restify = require("restify");
var server = restify.createServer();
server.use(restify.acceptParser(server.acceptable));
server.use(restify.queryParser());
server.use(restify.bodyParser());
server.pre(restify.pre.sanitizePath());
server.get("/products/?query",function(req,res,next){
res.send("product listing based on query");
return next();
})
server.get(/\/public\/?.*/, restify.serveStatic({
directory: './docs',
default: 'index.html'
}));
server.listen(3000,function(){
console.log("server is listening at 3000 port");
})
I want index.html spa page to load and in controller I will call $http.get("/products/?query",param) to get product details.