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 trialAmanda Olczak
4,124 PointsRouting 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.
1 Answer
miikis
44,957 PointsHey 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.
Kevin McNamara
7,483 PointsKevin McNamara
7,483 PointsBump.
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?