Some URLs of the app deployed work and others don't












0















I have a node js app and I deployed it to azure.



https://<mysite>.azurewebsites.net/orders
https://<mysite>.azurewebsites.net/item



Both of these URLs should be working but only the first one works . If i run the app in localhost both of them work. The error that gives me it is a 404 and it says:



the resource you are looking for has been removed, had its name is temporarily unavailable


This is the itemRoute.js class :



const express = require('express');
const router = express.Router();

const item_controller = require('../controllers/itemController');

router.get('/',item_controller.getAll);
router.get('/:id',item_controller.getById);
router.get('/:id',item_controller.getByIdParts);
router.get('/name/:name', item_controller.getByName);
router.post('/',item_controller.post);
router.put('/:id',item_controller.put);
router.delete('/:id', item_controller.deleteItem);
module.exports = router;


and this is the orderRoute.js:



const express = require('express');
const router = express.Router();

const order_controller = require('../controllers/orderController');

router.get('/test', order_controller.test);

router.post('/',order_controller.post);
router.get('/', order_controller.getAll);
router.get('/:id',order_controller.getById);
router.get('/user/:userEmail', order_controller.getByUser);
router.get('/city/:city', order_controller.getByCity);
router.get('/:id/:reference', order_controller.getByReference);
router.get('/item/:itemId', order_controller.getByItem);
router.get('/state/:state', order_controller.getByState);
router.get('/:id/item', order_controller.getItem);
router.delete('/:id', order_controller.deleteOrder);
module.exports = router;


app.js class ( the dev_db_url variable is with *** because it had the password):



//app.js
const express = require('express');
const bodyParser = require('body-parser');

const order = require('./app/routes/orderRoute'); //Imports routes for the encomendas
const item = require('./app/routes/itemRoute');

const app = express();

// Set up mongoose connection
const mongoose = require('mongoose'); //.set('debug',true);
let dev_db_url = 'mongodb:***;
const mongoDB = process.env.MONGODB_URI || dev_db_url;
mongoose.connect(mongoDB, { useNewUrlParser: true });
mongoose.Promise = global.Promise;
const db = mongoose.connection;
db.on('error', console.error.bind(console, 'MongoDB connection error:'));


app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: true}));//false})); //problem w/ objects from armarioswebapi was here, changed to true



app.use('/orders', order);
app.use('/item', item);


//Added CORS (Cross-Origin Resource Sharing) support
var cors = require('cors');
// app.use(cors());
app.use(cors({
origin: true,
credentials: true
}));

// Node is complaining because the TLS (SSL) certificate it's been given is self-signed (i.e. it has no parent - a depth of 0). It expects to find a certificate signed by another certificate that is installed in your OS as a trusted root.

// Your "fix" is to disable Node from rejecting self-signed certificates by allowing ANY unauthorised certificate.
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";


let port = process.env.PORT || 1234;

//app.listen(port, () => {
app.listen(process.env.PORT || 1234, () => {
console.log('Orders server is up and running on port number ' + port);
});


itemController class:



const service = require('../services/itemService');

exports.test = function (req, res) {
res.send('Greetings from the Test controller!');
};
exports.post = function (req, res) {
service.post(req,res);

};

exports.getById = function (req, res) {
service.getById(req, res);

};

exports.getByIdParts = function (req, res) {
service.getByIdParts(req, res);

};

exports.getByName = function (req, res) {
service.getByName(req, res);

};

exports.getAll = function (req, res) {
service.getAll(req, res);

};

exports.allItems = function (req, res) {
service.getItems(req, res);

};

exports.put = function (req, res) {
service.put(req, res);

};

exports.deleteItem = function (req, res) {
service.deleteItem(req, res);

};









share|improve this question

























  • Perhaps your error is in your item controller? You haven't shared any of that code, so it's impossible to tell for sure.

    – David Makogon
    Jan 2 at 17:19











  • I've edited the question with the itemController code and the orderController code.

    – Francisco Barril
    Jan 2 at 20:00
















0















I have a node js app and I deployed it to azure.



https://<mysite>.azurewebsites.net/orders
https://<mysite>.azurewebsites.net/item



Both of these URLs should be working but only the first one works . If i run the app in localhost both of them work. The error that gives me it is a 404 and it says:



the resource you are looking for has been removed, had its name is temporarily unavailable


This is the itemRoute.js class :



const express = require('express');
const router = express.Router();

const item_controller = require('../controllers/itemController');

router.get('/',item_controller.getAll);
router.get('/:id',item_controller.getById);
router.get('/:id',item_controller.getByIdParts);
router.get('/name/:name', item_controller.getByName);
router.post('/',item_controller.post);
router.put('/:id',item_controller.put);
router.delete('/:id', item_controller.deleteItem);
module.exports = router;


and this is the orderRoute.js:



const express = require('express');
const router = express.Router();

const order_controller = require('../controllers/orderController');

router.get('/test', order_controller.test);

router.post('/',order_controller.post);
router.get('/', order_controller.getAll);
router.get('/:id',order_controller.getById);
router.get('/user/:userEmail', order_controller.getByUser);
router.get('/city/:city', order_controller.getByCity);
router.get('/:id/:reference', order_controller.getByReference);
router.get('/item/:itemId', order_controller.getByItem);
router.get('/state/:state', order_controller.getByState);
router.get('/:id/item', order_controller.getItem);
router.delete('/:id', order_controller.deleteOrder);
module.exports = router;


app.js class ( the dev_db_url variable is with *** because it had the password):



//app.js
const express = require('express');
const bodyParser = require('body-parser');

const order = require('./app/routes/orderRoute'); //Imports routes for the encomendas
const item = require('./app/routes/itemRoute');

const app = express();

// Set up mongoose connection
const mongoose = require('mongoose'); //.set('debug',true);
let dev_db_url = 'mongodb:***;
const mongoDB = process.env.MONGODB_URI || dev_db_url;
mongoose.connect(mongoDB, { useNewUrlParser: true });
mongoose.Promise = global.Promise;
const db = mongoose.connection;
db.on('error', console.error.bind(console, 'MongoDB connection error:'));


app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: true}));//false})); //problem w/ objects from armarioswebapi was here, changed to true



app.use('/orders', order);
app.use('/item', item);


//Added CORS (Cross-Origin Resource Sharing) support
var cors = require('cors');
// app.use(cors());
app.use(cors({
origin: true,
credentials: true
}));

// Node is complaining because the TLS (SSL) certificate it's been given is self-signed (i.e. it has no parent - a depth of 0). It expects to find a certificate signed by another certificate that is installed in your OS as a trusted root.

// Your "fix" is to disable Node from rejecting self-signed certificates by allowing ANY unauthorised certificate.
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";


let port = process.env.PORT || 1234;

//app.listen(port, () => {
app.listen(process.env.PORT || 1234, () => {
console.log('Orders server is up and running on port number ' + port);
});


itemController class:



const service = require('../services/itemService');

exports.test = function (req, res) {
res.send('Greetings from the Test controller!');
};
exports.post = function (req, res) {
service.post(req,res);

};

exports.getById = function (req, res) {
service.getById(req, res);

};

exports.getByIdParts = function (req, res) {
service.getByIdParts(req, res);

};

exports.getByName = function (req, res) {
service.getByName(req, res);

};

exports.getAll = function (req, res) {
service.getAll(req, res);

};

exports.allItems = function (req, res) {
service.getItems(req, res);

};

exports.put = function (req, res) {
service.put(req, res);

};

exports.deleteItem = function (req, res) {
service.deleteItem(req, res);

};









share|improve this question

























  • Perhaps your error is in your item controller? You haven't shared any of that code, so it's impossible to tell for sure.

    – David Makogon
    Jan 2 at 17:19











  • I've edited the question with the itemController code and the orderController code.

    – Francisco Barril
    Jan 2 at 20:00














0












0








0








I have a node js app and I deployed it to azure.



https://<mysite>.azurewebsites.net/orders
https://<mysite>.azurewebsites.net/item



Both of these URLs should be working but only the first one works . If i run the app in localhost both of them work. The error that gives me it is a 404 and it says:



the resource you are looking for has been removed, had its name is temporarily unavailable


This is the itemRoute.js class :



const express = require('express');
const router = express.Router();

const item_controller = require('../controllers/itemController');

router.get('/',item_controller.getAll);
router.get('/:id',item_controller.getById);
router.get('/:id',item_controller.getByIdParts);
router.get('/name/:name', item_controller.getByName);
router.post('/',item_controller.post);
router.put('/:id',item_controller.put);
router.delete('/:id', item_controller.deleteItem);
module.exports = router;


and this is the orderRoute.js:



const express = require('express');
const router = express.Router();

const order_controller = require('../controllers/orderController');

router.get('/test', order_controller.test);

router.post('/',order_controller.post);
router.get('/', order_controller.getAll);
router.get('/:id',order_controller.getById);
router.get('/user/:userEmail', order_controller.getByUser);
router.get('/city/:city', order_controller.getByCity);
router.get('/:id/:reference', order_controller.getByReference);
router.get('/item/:itemId', order_controller.getByItem);
router.get('/state/:state', order_controller.getByState);
router.get('/:id/item', order_controller.getItem);
router.delete('/:id', order_controller.deleteOrder);
module.exports = router;


app.js class ( the dev_db_url variable is with *** because it had the password):



//app.js
const express = require('express');
const bodyParser = require('body-parser');

const order = require('./app/routes/orderRoute'); //Imports routes for the encomendas
const item = require('./app/routes/itemRoute');

const app = express();

// Set up mongoose connection
const mongoose = require('mongoose'); //.set('debug',true);
let dev_db_url = 'mongodb:***;
const mongoDB = process.env.MONGODB_URI || dev_db_url;
mongoose.connect(mongoDB, { useNewUrlParser: true });
mongoose.Promise = global.Promise;
const db = mongoose.connection;
db.on('error', console.error.bind(console, 'MongoDB connection error:'));


app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: true}));//false})); //problem w/ objects from armarioswebapi was here, changed to true



app.use('/orders', order);
app.use('/item', item);


//Added CORS (Cross-Origin Resource Sharing) support
var cors = require('cors');
// app.use(cors());
app.use(cors({
origin: true,
credentials: true
}));

// Node is complaining because the TLS (SSL) certificate it's been given is self-signed (i.e. it has no parent - a depth of 0). It expects to find a certificate signed by another certificate that is installed in your OS as a trusted root.

// Your "fix" is to disable Node from rejecting self-signed certificates by allowing ANY unauthorised certificate.
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";


let port = process.env.PORT || 1234;

//app.listen(port, () => {
app.listen(process.env.PORT || 1234, () => {
console.log('Orders server is up and running on port number ' + port);
});


itemController class:



const service = require('../services/itemService');

exports.test = function (req, res) {
res.send('Greetings from the Test controller!');
};
exports.post = function (req, res) {
service.post(req,res);

};

exports.getById = function (req, res) {
service.getById(req, res);

};

exports.getByIdParts = function (req, res) {
service.getByIdParts(req, res);

};

exports.getByName = function (req, res) {
service.getByName(req, res);

};

exports.getAll = function (req, res) {
service.getAll(req, res);

};

exports.allItems = function (req, res) {
service.getItems(req, res);

};

exports.put = function (req, res) {
service.put(req, res);

};

exports.deleteItem = function (req, res) {
service.deleteItem(req, res);

};









share|improve this question
















I have a node js app and I deployed it to azure.



https://<mysite>.azurewebsites.net/orders
https://<mysite>.azurewebsites.net/item



Both of these URLs should be working but only the first one works . If i run the app in localhost both of them work. The error that gives me it is a 404 and it says:



the resource you are looking for has been removed, had its name is temporarily unavailable


This is the itemRoute.js class :



const express = require('express');
const router = express.Router();

const item_controller = require('../controllers/itemController');

router.get('/',item_controller.getAll);
router.get('/:id',item_controller.getById);
router.get('/:id',item_controller.getByIdParts);
router.get('/name/:name', item_controller.getByName);
router.post('/',item_controller.post);
router.put('/:id',item_controller.put);
router.delete('/:id', item_controller.deleteItem);
module.exports = router;


and this is the orderRoute.js:



const express = require('express');
const router = express.Router();

const order_controller = require('../controllers/orderController');

router.get('/test', order_controller.test);

router.post('/',order_controller.post);
router.get('/', order_controller.getAll);
router.get('/:id',order_controller.getById);
router.get('/user/:userEmail', order_controller.getByUser);
router.get('/city/:city', order_controller.getByCity);
router.get('/:id/:reference', order_controller.getByReference);
router.get('/item/:itemId', order_controller.getByItem);
router.get('/state/:state', order_controller.getByState);
router.get('/:id/item', order_controller.getItem);
router.delete('/:id', order_controller.deleteOrder);
module.exports = router;


app.js class ( the dev_db_url variable is with *** because it had the password):



//app.js
const express = require('express');
const bodyParser = require('body-parser');

const order = require('./app/routes/orderRoute'); //Imports routes for the encomendas
const item = require('./app/routes/itemRoute');

const app = express();

// Set up mongoose connection
const mongoose = require('mongoose'); //.set('debug',true);
let dev_db_url = 'mongodb:***;
const mongoDB = process.env.MONGODB_URI || dev_db_url;
mongoose.connect(mongoDB, { useNewUrlParser: true });
mongoose.Promise = global.Promise;
const db = mongoose.connection;
db.on('error', console.error.bind(console, 'MongoDB connection error:'));


app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: true}));//false})); //problem w/ objects from armarioswebapi was here, changed to true



app.use('/orders', order);
app.use('/item', item);


//Added CORS (Cross-Origin Resource Sharing) support
var cors = require('cors');
// app.use(cors());
app.use(cors({
origin: true,
credentials: true
}));

// Node is complaining because the TLS (SSL) certificate it's been given is self-signed (i.e. it has no parent - a depth of 0). It expects to find a certificate signed by another certificate that is installed in your OS as a trusted root.

// Your "fix" is to disable Node from rejecting self-signed certificates by allowing ANY unauthorised certificate.
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";


let port = process.env.PORT || 1234;

//app.listen(port, () => {
app.listen(process.env.PORT || 1234, () => {
console.log('Orders server is up and running on port number ' + port);
});


itemController class:



const service = require('../services/itemService');

exports.test = function (req, res) {
res.send('Greetings from the Test controller!');
};
exports.post = function (req, res) {
service.post(req,res);

};

exports.getById = function (req, res) {
service.getById(req, res);

};

exports.getByIdParts = function (req, res) {
service.getByIdParts(req, res);

};

exports.getByName = function (req, res) {
service.getByName(req, res);

};

exports.getAll = function (req, res) {
service.getAll(req, res);

};

exports.allItems = function (req, res) {
service.getItems(req, res);

};

exports.put = function (req, res) {
service.put(req, res);

};

exports.deleteItem = function (req, res) {
service.deleteItem(req, res);

};






node.js azure azure-web-sites






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 2 at 17:22







Francisco Barril

















asked Jan 2 at 16:18









Francisco BarrilFrancisco Barril

247




247













  • Perhaps your error is in your item controller? You haven't shared any of that code, so it's impossible to tell for sure.

    – David Makogon
    Jan 2 at 17:19











  • I've edited the question with the itemController code and the orderController code.

    – Francisco Barril
    Jan 2 at 20:00



















  • Perhaps your error is in your item controller? You haven't shared any of that code, so it's impossible to tell for sure.

    – David Makogon
    Jan 2 at 17:19











  • I've edited the question with the itemController code and the orderController code.

    – Francisco Barril
    Jan 2 at 20:00

















Perhaps your error is in your item controller? You haven't shared any of that code, so it's impossible to tell for sure.

– David Makogon
Jan 2 at 17:19





Perhaps your error is in your item controller? You haven't shared any of that code, so it's impossible to tell for sure.

– David Makogon
Jan 2 at 17:19













I've edited the question with the itemController code and the orderController code.

– Francisco Barril
Jan 2 at 20:00





I've edited the question with the itemController code and the orderController code.

– Francisco Barril
Jan 2 at 20:00












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54009681%2fsome-urls-of-the-app-deployed-work-and-others-dont%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54009681%2fsome-urls-of-the-app-deployed-work-and-others-dont%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

SQL update select statement

WPF add header to Image with URL pettitions [duplicate]