Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8137691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T11:13:48+00:00 2026-06-06T11:13:48+00:00

I have a directory like this /Workspace /app app.js /lib /public /styles *.css /scripts

  • 0

I have a directory like this

/Workspace
  /app
    app.js
  /lib
    /public
      /styles
        *.css
      /scripts
        *.js
    /views
      *.jade

from app.js in app, I have the following code:

libPath = __dirname + '/../lib'

... express stuff ...

app.configure(function() {
  app.set('view', libPath + '/views')
  ... express stuff ...
  app.use(express.static(libPath + '/public'))

... rest of the app ...

Now, the problem is that Jade can’t find any of the views, but all the static assets are found. Thus, app.set('view') isn’t working, but express.static is. If I copy the views directory to app, using __dirname + '/views' works fine. Anyone know why this is happening?

doing app.get('view'), I get a directory like this: /Users/jong/Workspace/app/../lib/views. I tried doing the absolute route /Users/jong/Workspace/lib/views as well to no avail. It’s just weird that this directory works for static assets but not templates.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T11:13:49+00:00Added an answer on June 6, 2026 at 11:13 am

    You have a mistype, the correct option name is views, not view.

    Configure your application like

        app.set('views', __dirname + '/views');
        app.set('view engine', 'jade');
        app.set('view options', { layout: true });
    

    But the main root of issue is that you seem to misunderstand how express (and the MVC at all) works.

    express sends out the static data to the browser, using your express.static configure directive, once the request url matches the existing static file path.

    Otherwise, it tries to find any defined route for the requested path and to execute the associated controller (which may or may not use the template engine in turn).

    So, in order to show e.g. the index page (even if it has no parameters), given you have an index.js in your views folder, you have to do something like

    app.get('/', function (req, res, next) {
        res.render('index', {});
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a directory structure like this: --bin/ --lib/ --data/ So basically, the executable
When creating gems, I often have a directory structure like this: |--lib |-- helpers.rb
I think I'm missing something here. I have a directory like this: myapp |-lib
If I have a directory structure like this: - index.php - public - img
I have a directory structure like this /ub/ /ub/img/ /ub/inc/ Basically I want to
I have a directory structure like this... dir/ build.py dir2 dir3/ packages.py Now the
let's say i have directory paths looking like this: this/is/the/basedir/path/a/include this/is/the/basedir/path/b/include this/is/the/basedir/path/a this/is/the/basedir/path/b In
Let's say I have a directory structure like this: animals/dog/details animals/cat/details animals/frog/details animals/horse/details Using
I am a beginner in SVN.I have the SVN directory structure like this: |-trunk
I have a directory with files that look like this: 001_something.php 002_something_else.php 004_xyz.php 005_do_good_to_others.php

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.