Skip to content
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

Kerrokantasi-ui should be runnable from static files only #410

Open
vikoivun opened this issue Sep 21, 2017 · 3 comments
Open

Kerrokantasi-ui should be runnable from static files only #410

vikoivun opened this issue Sep 21, 2017 · 3 comments

Comments

@vikoivun
Copy link
Member

vikoivun commented Sep 21, 2017

Currently kerrokantasi-ui requires it's own backend server, mostly for authentication, but also for rendering the initial template. There's also server side rendering, which will of course need a server. But only if very dynamic things need to be rendered.

It would be very nice, if the server was fully optional. Authentication can be handled using implicit flow and our new OpenID connect package. SSR could be replaced by a background job, that generated the hearing pages nightly or so.

@akx
Copy link
Contributor

akx commented Sep 25, 2017

Aside from authentication, KK-UI actually can be run from static files as it is, though you'll need to craft an index.html by yourself (until someone plonks in html-webpack-plugin to do that in a way that populates API_BASE_URL and UI_CONFIG).

So – create a dist/index.html:

<html lang="fi">
<head><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta content="width=device-width, initial-scale=1" name="viewport"/><title>Kerro Kantasi</title>
</head>
<body><div id="root"></div><script>
window.API_BASE_URL = "https://api.hel.fi/kerrokantasi";
window.UI_CONFIG = null;
</script>
<script src="/app.HURRDURRHASH.js"></script>
</body></html>

Then compile the bundle (and replace HURRDURRHASH above with the bundle's hash):

./node_modules/.bin/webpack --config ./conf/webpack/prod.js --progress --colors

Then, use a static file server (I'm using live-server because I have it handy) to serve things:

cd dist
live-server

Et voilà!

image

@Rikuoja
Copy link
Contributor

Rikuoja commented Apr 22, 2021

Related to #446 . Would be a good idea to serve static files without a server.

@Rikuoja
Copy link
Contributor

Rikuoja commented Apr 22, 2021

However, with static serving, how would facebook share metadata work? Discussion here #317

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants