javascript - ui route, node, express, 404 html files -
i can't figure out life of me. i'm using node, express, angular , ui.route. i'm trying accomplish following,
- have
index.htmlmaster - have
some.htmlpartials
i setup application use ejs instead of jade (don't know if matters @ all)? error i'm getting can't find localhost:3000/views/partial-home.html 404, tried types of different paths in routing,
(function(){ var app = angular.module('routerapp', ['ui.router']); app.config(function($stateprovider, $urlrouterprovider) { $urlrouterprovider.otherwise('/about'); $stateprovider .state('home-about', { url: '/home-about', templateurl: '/views/partial-home.html' }) .state('about', { }); }); }()); i not have particular in app.js file handle html or in route/index.js, think it's using index.ejs well. steps missing in using html , why error not finding partial-home.html
//routes/index.js var express = require('express'); var router = express.router(); /* home page. */ router.get('/', function(req, res, next) { res.render('index', { title: 'express' }); }); module.exports = router; there posts topic none kinda sums 2 issues using html files , why 404. appreciate can get. thanks!
you still need 'mount' router app.
app.use('/', router); the router relative path mount to, in case root /. can mount path , router relative path. e.g.
app.use('/bar', router); and router 'mini-app' invoked when application gets (or other http method) /bar/ path.
Comments
Post a Comment