Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to add my existing views,stylesheets,javascripts to express?
    primarykey
    data
    text
    <p>I have an existing coded frontend i.e views,javascripts,stylesheets (<a href="https://github.com/stdrunk/Taskr" rel="nofollow noreferrer">https://github.com/stdrunk/Taskr</a>) and I intend to add this to the express framework so that i can link it to the db. I added the contents to the public folder. The javascripts in the javascript folder, css in stylesheets, and images in images folder. Then i changed the code of app.js according to this <a href="https://stackoverflow.com/questions/4529586/render-basic-html-view-in-node-js-express">Render basic HTML view?</a></p> <p>Now when run app.js and open the page in the browser i get a stripped version of my original page. No error comes in the console. This is my app.js</p> <pre><code>/** * Module dependencies. */ var express = require('express'); var routes = require('./routes'); var user = require('./routes/user'); var http = require('http'); var path = require('path'); var app = express(); // all environments app.set('port', process.env.PORT || 3000); //app.set('views', path.join(__dirname, 'views')); app.set('view engine', 'jade'); app.set('views', __dirname + '/views'); app.engine('html', require('ejs').renderFile); app.use(express.static(__dirname + '/public')); app.use(express.favicon()); app.use(express.logger('dev')); app.use(express.json()); app.use(express.urlencoded()); app.use(express.methodOverride()); app.use(app.router); app.use(express.static(path.join(__dirname, 'public'))); // development only if ('development' == app.get('env')) { app.use(express.errorHandler()); } app.get('/', routes.index); app.get('/users', user.list); app.get('/home', function (req, res) { res.render('index.html'); }); http.createServer(app).listen(app.get('port'), function(){ console.log('Express server listening on port ' + app.get('port')); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload