Let"s talk about the project briefly first
- use the angular6.x version
- use official cli scaffolding
- before and after separation, the angular module invokes the api,node of node and invokes the service of the backend
- the packaged dist directory of angular is placed in the static resource directory of node
- node uses koa as the framework, accompanied by koa-static,koa-router,koa-views
the code is as follows
/*
* node
* ejs
*/
// router
router.prefix("/node")
router.get("/index", async (ctx, next) => {
await ctx.render("index.ejs", {})
// angular
// angular
// angualrindex.htmlindex.ejsjs
});
// routerapp.js
// angular app-routing.module.ts
@NgModule({
imports: [RouterModule.forRoot(routes, { useHash: true})], // hash URL
// imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
// app :
loadChildren: "./pages/aaa/aaa.module-sharpaaa"
when I pack up, I will get this page by visiting xxxxx:3001/node/index. The questions are as follows
//
// http://localhost:3001/-sharp/store/home
// 404 nodeurl
is there any way to prevent angular from modifying the url address, such as the access address:
http://localhost:3001/node/index/-sharp/store/home
// angualrurl-sharp
// cli ng build --prod
because there is no real jump on the page in hash routing mode, why is the url http://localhost:3001/-sharp/store/home after entering? shouldn"t it be http://localhost:3001/node/index/-sharp/store/home
?