I'm pretty new to node.js and express.js so I feel I may be having problems with the syntax, I have the following node.js code:
var express = require('express');
var path = require('path');
var app = express();
app.set('port', process.env.PORT);
app.use(express.static(path.join(__dirname, 'static')));
app.get('/', function(req,res){
res.render("/public/index")
});
app.get('/secure', function(req,res){
res.render("/secure/index")
});
var server = app.listen(app.get('port'), function(){
var port = server.address().port;
});
This allows me to access the secure page perfectly fine, however the page throws an "Internal Server Error" whenever trying to access the public page, why is this? My file structure is
static
-public
--index.html
-secure
--index.html
If I move the public index.html up into static then it works fine, however I'd prefer to have the above file structure, is there anyway I can do this? Thanks.