Skip to content

Commit

Permalink
fixed error not allowing views to display
Browse files Browse the repository at this point in the history
  • Loading branch information
KERTZ authored and KERTZ committed Apr 6, 2017
1 parent 8547980 commit 5ecd139
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
6 changes: 3 additions & 3 deletions app.js
Expand Up @@ -4,13 +4,13 @@ var favicon = require('serve-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');

var pug = require('pug');
var routes = require('./routes/index');

var app = express();

// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('views', path.join('./public/views'));
app.set('view engine', 'pug');

// uncomment after placing your favicon in /public
Expand All @@ -19,7 +19,7 @@ app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));
app.use(express.static(path.join(__dirname, '/public')));

app.use('/', routes);

Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion views/layout.jade → public/views/layout.pug
Expand Up @@ -2,6 +2,6 @@ doctype html
html
head
title= title
link(rel='stylesheet', href='/stylesheets/style.css')
link(rel='stylesheet', href='../stylesheets/style.css')
body
block content
8 changes: 6 additions & 2 deletions routes/index.js
@@ -1,6 +1,5 @@
var express = require('express');
var router = express.Router();

var db = require('../queries');


Expand All @@ -10,5 +9,10 @@ router.post('/api/puppies', db.createPuppy);
router.put('/api/puppies/:id', db.updatePuppy);
router.delete('/api/puppies/:id', db.removePuppy);

// application -------------------------------------------------------------
router.get('/', function (req, res) {

res.render('index', {title: 'node-postgres-promises'}); // load the single view file (angular will handle the page changes on the front-end)
});

module.exports = router;
module.exports = router;

0 comments on commit 5ecd139

Please sign in to comment.