Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Coderacer- Getting my partial file to render

I am going through the Code Racer videos and on the Build Server with Express video I can't get the index.eco partial to render within my layout.eco file if I call that from my server.coffee file. I understand that the code from the video is now a bit outdated-- what do I need to change to have it render? Right now I am using this in my server.coffee file (I switched server.coffee back to refer to index.eco, following the video instructions):

require ('coffee-script');
express = require ('express');
cons = require ('consolidate');

app = express();
app.engine 'eco', cons.eco

app.get '/', (req, res) ->
res.render 'index.eco',
title: "Our Special Title"

console.log "Server is listening"

and this in my package.json file:

"name": "coderacer",
"version": "0.0.0",
"description": "An awesome game",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"author": "",
"license": "BSD-2-Clause",
"coffee-script": "*",
"express": "*",
"eco": "*",
"consolidate": "*"


1 Answer

Alicia. Using coffeescript to learn Node.js it would make things really difficult. Anyway, add the asterisk to the dependencies on your json file like this: "coffeescript": "*". The asterisk is there but it's hard to see. After that, save the file and use a command in the terminal (or command prompt for windows) and type "npm install". This will install the modules for the project and then run the project and see if it worked.

The semicolons are the problem, you don't need them when you are using coffeescript