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

JavaScript User Authentication With Express and Mongo User Registration Define User Registration Routes

Amanda Olczak
Amanda Olczak
4,124 Points

Routing Sign Up button to registration route, not using jade,

I am trying to implement this an app project, specifically, I need to sign up users from a landing page. How does the sign up button route to: router.get('/register', function(req, res, next) { return res.send('Register today!'); }); ? I am using Angular1 with ui-router, and not jade, to write my html.

Kevin McNamara
Kevin McNamara
7,483 Points

Bump.

I am also developing a MEAN project in which I would like to have the same functionality described in this project using AngularJS embedded into html files. I would really like to see an answer to this question because it seems JADE and AngularJS are not very compatible.

I know it is possible to use app.get('/', function(req, res) { res.sendFile(path.join(__dirname + 'index.html'); } in the app.js file. The problem with this, as I have read, is that it does not provide caching functionality, causing the project to be slower in production mode. Can anyone help me figure out how to serve html files with a router?

1 Answer

Hey Amanda,

You've probably figured this out by now but you can accomplish what you're trying to do via an anchor tag. Just add the route you desire as the tag's href attribute.