I need to write a webapp with Beego as backend and Angular 4 as frontend, I'm relatively new to both.
Inside my Beego-Project-Folder, I have a folder called "frontend" which was generated by
ng new frontend
I changed the outDir in .angular-cli.json from "dist/ "to "../assets".
So the structure looks like this:
.
├── assets
│ ├── favicon.ico
│ ├── index.html
│ ├── inline.bundle.js
│ ├── inline.bundle.js.map
│ ├── main.bundle.js
│ ├── main.bundle.js.map
│ ├── polyfills.bundle.js
│ ├── polyfills.bundle.js.map
│ ├── styles.bundle.js
│ ├── styles.bundle.js.map
│ ├── vendor.bundle.js
│ └── vendor.bundle.js.map
├── conf
│ └── app.conf
├── controllers
│ └── default.go
├── frontend
│ ├── e2e
│ ├── karma.conf.js
│ ├── node_modules
│ ├── package.json
│ ├── package-lock.json
│ ├── protractor.conf.js
│ ├── src
│ │ ├── app
│ │ ├── assets
│ │ ├── environments
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── main.ts
│ │ ├── polyfills.ts
│ │ ├── styles.css
│ │ ├── test.ts
│ │ ├── tsconfig.app.json
│ │ ├── tsconfig.spec.json
│ ├── tsconfig.json
│ └── tslint.json
├── main.go
├── models
├── routers
│ └── router.go
└── tests
└── default_test.go
My conf/app.conf (Beego Configuration File) looks like this:
appname = beego_angular
httpport = 8080
runmode = dev
StaticDir = assets:assets
viewspath = assets
When I run
cd frontend
ng build
cd ..
bee run
I get the error that the scripts can not be found (404), but the index.html can. This is my index.html:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Frontend</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root></app-root>
<script type="text/javascript" src="inline.bundle.js"></script>
<script type="text/javascript" src="polyfills.bundle.js"></script>
<script type="text/javascript" src="styles.bundle.js"></script>
<script type="text/javascript" src="vendor.bundle.js"></script>
<script type="text/javascript" src="main.bundle.js"></script>
</body>
</html>
What am I doing wrong? I just want Beego as a server for my Angular-App. If you need any additional info, let me know. Thanks.
Aucun commentaire:
Enregistrer un commentaire