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 8987461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:47:58+00:00 2026-06-15T21:47:58+00:00

I am having trouble getting the results from this ticket to work. I am

  • 0

I am having trouble getting the results from this ticket to work. I am just trying to create more modular blocks of code, and want to put the routes and views all together. I need a sanity check on this one.

I can’t get the route to pickup the Jade file using relative paths (and I dislike the relative paths): Error: Failed to lookup view "../test/app". Please help πŸ™‚

Github: https://github.com/franklovecchio/stackoverflow-13770206

Folder structure:

    .
    β”‚
    β”œβ”€β”€ package.json
    β”œβ”€β”€ public
    β”‚   └── lib
    β”‚       └── login
    β”‚           β”œβ”€β”€ 0.0.1
    β”‚           β”‚   └── routes.coffee
    β”‚           └── test
    β”‚               └── app.jade 
    β”œβ”€β”€ server.coffee
    └── views
        └── layout.jade

server.coffee

express = require('express')
http = require('http')
path = require('path')

app = express()

app.configure () ->
  app.set 'port', process.env.PORT or 3000 # Give us the ability to specify port through command-line or external process.

  app.set 'view options', 
    layout: false

  app.set 'view engine', 'jade'

  app.use express.favicon() # auto-gen
  app.use express.logger('dev') # auto-gen
  app.use express.bodyParser() # auto-gen
  app.use express.methodOverride() # auto-gen

  # Required by session() middleware
  # Pass the secret for signed cookies
  app.use express.cookieParser('The Stay Puft Marshmallow Man')

  app.use app.router

  app.use express.static(path.join(__dirname, '/public')) # Serve static assets.

app.configure 'development', ->
  app.use express.errorHandler()
  app.use require('readymade').middleware(root: '/public') # Make .coffee/.less serve as compiled .js/.css files.

# Routes

# ======================  Login ======================  # 
login = require './public/lib/login/0.0.1/routes'
app.get '/', login.view
# ====================== /Login ======================  # 

http.createServer(app).listen app.get('port'), ->
  console.log 'Express server listening on port: ' + app.get('port')

routes.coffee

exports.view = (req, res) ->

  res.render '../test/app'

app.jade

extends ../../../../views/layout

p login

layout.jade

doctype 5
html
  head
    title My title
    block head
  body
    #content
      block content

package.json

{
  "name": "myapp",
  "description": "modular",
  "version": "0.0.1",
  "private": true,
  "dependencies": {
    "express":"3.0.4",
    "less":"",
    "jade":"",
    "markitup":"",
    "readymade": ""
  }
}
  • 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-15T21:47:59+00:00Added an answer on June 15, 2026 at 9:47 pm

    It has to do with public directory being your static file serving directory. Remove the following lines from your server.coffee and it will work just fine.

    app.use express.static(path.join(__dirname, '/public')) # Serve static assets.
    

    Alternatively, put your code and views outside the public directory.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having trouble getting teh results i want from this mysql query. And
I'm having some trouble getting log4net to work from ASP.NET 3.5. This is the
I am having trouble getting well formatted results from my mysql query. Here is
My programmer is having trouble getting the location data (latitude and longitude) from this
I'm having trouble getting this to work. I've searched this site and found many
I'm having some trouble getting results from a c# OleDbCommand on an MS Access
I'm having trouble getting the results I want from a Salesforce/Apex/SOQL query. I want:
I am having some trouble getting expected results out of the zip command. Cases
im having trouble getting a string (containing a URL) from one activity to another.
I'm having trouble getting the CanExecute method of my command to work property. I've

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.