-
-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(Question) returning existing angular frontend #325
Comments
Take a look at angular integration demo [1]. If you don't understand leave a comment [1] https://github.com/decebals/pippo-demo/tree/master/pippo-demo-crudng |
Thanks for your answer! I looked at the demo. But the angular app in that demo is not what im looking for. I don't want to use the template language and angular at the same time and render it server side, I just want it to serve a single html file with all it's dependencies (js & css) without having to use webjarsAt etc. |
First step is to take a look at ➤ tree src/main/resources/public Then in your After this, if you don't want to use the So, variant with <head>
<link href="${publicAt('css/style.css')}" rel="stylesheet">
</head> Variant without <head>
<link href="public/css/style.css" rel="stylesheet">
</head> Now it's time to serve your static html. A possible solution can be: // send 'public/welcome.html' as response
GET("/", (routeContext) -> {
try {
String html = IoUtils.toString(getClass().getResourceAsStream("/public/welcome.html"));
routeContext.send(html);
} catch (IOException e) {
throw new PippoRuntimeException(e);
}
}); It's also possible to serve static file without "/public" prefix in the URL request. For this, instead of addPublicResourceRoute() you must use addPublicResourceRoute("/") If you need to serve only some artifact types( for example css and js) from root ("/") and the rest from public ("/public") please read [2]. Did what I say make sense for you? [1] http://www.pippo.ro/doc/static-files.html |
This does answer my question! Thank you very much! |
You are welcome! |
Hi, I would like to start using this framework for a small project im working on. I already have an angular frontend. I want to serve this angular app from pippo on the base url e.g.
GET("/", (routeContext) -> routeContext.send("index.html")); (with the js and css files)
I've looked at the documentation but I don't seem to understand.
Can someone help me?
Thanks in advance
The text was updated successfully, but these errors were encountered: