frontend

Micro frontend architecture advice

风流意气都作罢 提交于 2019-12-31 19:16:10
问题 We have several web applications that we wish to present under one single page application. We are looking for a micro-frontend architecture/framework to use. As we see it, these are our options for implementation: Using the single-spa open source framework: https://github.com/CanopyTax/single-spa Using Iframes (friendly Iframes) the hosting application (the shell) and loading each application according to the current url. Writing our own Javascript framework Other? The current state is a

How to deploy separated frontend and backend?

让人想犯罪 __ 提交于 2019-12-31 08:16:11
问题 I am developing a new project with react/express as the frontend and loopback as the backend api. I have separated both of them in my development environment with different ports. How should I deploy them in production? Hosting on a same server - separate the backend with a different sub-domain? Hosting on 2 different servers - seems impossible to use back the same domain. 回答1: I just answered a related question for AWS. You can deploy your frontend on a static hosting service and a CDN AWS

Is it safe to use base64 encoded images for web, Advantages and Disadvantages?

 ̄綄美尐妖づ 提交于 2019-12-30 17:23:30
问题 Is it safe to use base64 encoded images for web design, How does it compare in performance? Advantages and Disadvantages? 回答1: A base64 stream is about 33% heavier than a binary one (not taking into account the gzip compression over http that you have in place if you're serious about performances). If you put the base64 image directly in a page, it won't be cached separately. So it will be heavy for all pages using this image instead of being cachable with URL as key. You may think that it

Take a value 1-31 and convert it to ordinal date w/ JavaScript

旧城冷巷雨未停 提交于 2019-12-30 05:58:08
问题 Is there a JavaScript code snippet to take a value of 1-31 and convert it to 1st, 2nd, 3rd, etc? Thanks! 回答1: function getOrdinal(n) { var s=["th","st","nd","rd"], v=n%100; return n+(s[(v-20)%10]||s[v]||s[0]); } Thanks @RobG bit modified version function getOrdinal(n) { if((parseFloat(n) == parseInt(n)) && !isNaN(n)){ var s=["th","st","nd","rd"], v=n%100; return n+(s[(v-20)%10]||s[v]||s[0]); } return n; } Tests getOrdinal("test"); // test getOrdinal(1.5); // 1.5 getOrdinal(1); // 1st

Take a value 1-31 and convert it to ordinal date w/ JavaScript

瘦欲@ 提交于 2019-12-30 05:57:35
问题 Is there a JavaScript code snippet to take a value of 1-31 and convert it to 1st, 2nd, 3rd, etc? Thanks! 回答1: function getOrdinal(n) { var s=["th","st","nd","rd"], v=n%100; return n+(s[(v-20)%10]||s[v]||s[0]); } Thanks @RobG bit modified version function getOrdinal(n) { if((parseFloat(n) == parseInt(n)) && !isNaN(n)){ var s=["th","st","nd","rd"], v=n%100; return n+(s[(v-20)%10]||s[v]||s[0]); } return n; } Tests getOrdinal("test"); // test getOrdinal(1.5); // 1.5 getOrdinal(1); // 1st

how to host angular 2 website?

做~自己de王妃 提交于 2019-12-30 00:40:11
问题 How to host angular 2 website? I am new to angular 2 and I made a simple website with no back-end. I wondered that when I tried to open directly index.html file, it opens with error. But after command "npm start" it works fine, which runs a local server on computer. So, how to host this website on simple hosting sites (Not a Dedicated Server..!)? I think hosting sites automatically find index.html file, but here is the problem, index.html is don't start without "npm start" command. can I have

Is the web browser performance rule “only 2 requests in parallel per hostname” still correct?

久未见 提交于 2019-12-29 09:11:32
问题 In his book "High Performance Websites" Steve Souders wrote (2007) that browsers limit parallel requests to a domain/hostname to two at a time. Is this still valid today? 回答1: Almost incorrect today. Most browsers have upgraded to 6 parallel connections. See Steve Souder's Browserscope > Network tab > Connections per Hostname. Older browsers still restrict to 2 connections - that may or may not be relevant to you depending on the browsers your application supports. 回答2: Firefox bumped up its

How to check if a tab has been reloaded in background.js?

一个人想着一个人 提交于 2019-12-29 01:47:16
问题 I am writing a Chrome extension which needs to detect if the tab has been reloaded, that is to say, the user refreshed the page (either by pressing the refresh button, or put a cursor behind the URL and press Enter) with no URL change. If it happens, then I will reinitialize my variables defined in background.js . I am wondering how could I get this " is_reload " boolean value? I tried to make use of windows.performance.navigation.type , but it doesn't have any effect in the background.js .

JavaScript Duplicate Cookies

不打扰是莪最后的温柔 提交于 2019-12-25 18:13:06
问题 I'm using the Hapi framework for a Node.js application, and the Hapi framework comes with its own Cookie management tools, which i'm using for authentication. The framework then sets a cookie named session, with a json value encoded to base64. The domain is set to example.com (not .example.com) Now, the problem lies when i attempt to edit this cookie client-side, by doing the following document.cookie = 'session=' + btoa(JSON.stringify(_decoded)) + "; path=/; domain=example.com"; This

Yii2-advanced, how to display images from backend in frontend

▼魔方 西西 提交于 2019-12-25 14:13:15
问题 I have my images in /backend/web/uploads. Now I would like to show them in /frontend/views/site/index So in index view I'm trying to show them like this: $planet = Planet::find()->all(); foreach($planet AS $pl=> $p){ echo Html::img('/backend/web/'.($p->path)); } in $p->path - uploads/123.jpg But this path is not valid, how can I display images from /backend/web/uploads in /frontend/views/site/index ? 回答1: It's already answered here. There are two main options to achieve that. 1) You can