serverside-javascript

How can I combine multiple loaders (CSS, LESS, ttf, etc) in NextJS config file?

梦想的初衷 提交于 2020-01-13 05:09:38
问题 I'm working on moving a React app to SSR using NextJS and per the docs, I'm using the CSS and LESS modules for Next. The problem is that it seems that only one works at a time. Some of the app still relies on Bootstrap for now, and I have not been able to get the Bootstrap (either CSS or LESS) to work with these loaders. The main problem is that files like .ttf, .svg, .gif, etc are referenced inside the Bootstrap stylesheets but the loaders aren't in the Next modules. Here's a general idea of

How can I combine multiple loaders (CSS, LESS, ttf, etc) in NextJS config file?

房东的猫 提交于 2020-01-13 05:08:49
问题 I'm working on moving a React app to SSR using NextJS and per the docs, I'm using the CSS and LESS modules for Next. The problem is that it seems that only one works at a time. Some of the app still relies on Bootstrap for now, and I have not been able to get the Bootstrap (either CSS or LESS) to work with these loaders. The main problem is that files like .ttf, .svg, .gif, etc are referenced inside the Bootstrap stylesheets but the loaders aren't in the Next modules. Here's a general idea of

How to interact with Web server using JavaScript

前提是你 提交于 2020-01-03 17:32:47
问题 I am trying to develop an Interactive chat application using AppWeb open source web Server. I need to have some machanism that will enable Web server to send updated messages to client, so that when remote usre sends messages that will get updated automaticaly at the client end. There are some methods to do this using HTML5 Web Sockets and Server sent events. But we need to implement it in HTML and JavaScript only not HTML5. So I need some pooling machanism that will keep pooling my Web

how to detect that user's connection is lost or he closed the browser window in Nodejs socket.io

前提是你 提交于 2019-12-30 00:39:13
问题 I have a chat application on Node.js and Socket.io, user can connect and disconnect with a button... I am having a list of online users which is perfectly managed with the help of my defined events that user trigger. But the problem is I am unable to detect if the user has lost his connection or closed the browser window without disconnecting himself manually(by the disconnect button)... This socket.io event is fired only when user disconnects himself not when he lost his connection. socket

How to call ad hoc SSJS from a Java Bean

送分小仙女□ 提交于 2019-12-23 02:44:48
问题 I need to call ssjs from a java bean similar to this this issue. The issue is that the code I need to execute comes from a configuration document, and may look like: getComponent("xxx").getValue(); I have built a version that does : String compute = doc.getItemValueString("SSJSStuff"); String valueExpr = "#{javascript:" + compute + "}"; FacesContext fc = FacesContext.getCurrentInstance(); Application app = fc.getApplication(); ValueBinding vb = app.createValueBinding(valueExpr); String vreslt

JSON object vs window variable for passing server-side rendered initial state using reactjs

感情迁移 提交于 2019-12-22 14:18:05
问题 In an isomorphic application with Reactjs, you need to pass the identical initial state that was rendered on the server down to the client (which will then 'rehydrate' the app with event bindings and such). I've seen two approaches to passing this initial state down-- Setting a global variable to the window: <script> window.initialState = {{JSON.stringify(initialState)}} ; </script> Or passing it as a JSON object: <script id="initial-state" type="application/json"> {{JSON.stringify

JSON object vs window variable for passing server-side rendered initial state using reactjs

假装没事ソ 提交于 2019-12-22 14:16:07
问题 In an isomorphic application with Reactjs, you need to pass the identical initial state that was rendered on the server down to the client (which will then 'rehydrate' the app with event bindings and such). I've seen two approaches to passing this initial state down-- Setting a global variable to the window: <script> window.initialState = {{JSON.stringify(initialState)}} ; </script> Or passing it as a JSON object: <script id="initial-state" type="application/json"> {{JSON.stringify

Server side javascript on Google app engine

China☆狼群 提交于 2019-12-21 03:34:28
问题 Is there any way to run a Javascript engine, like Spidermonkey, on Google App Engine? Spidermonkey is a C module, so obviously that wont work (GAE doesn't allow those types of modules)... is there something else available? 回答1: Google is now supporting custom language on Google App Engine. So we can do Node.js https://www.youtube.com/watch?v=Q8jZHc0NS6A https://developers.google.com/cloud/managed-vms 回答2: Here is an article about running Rhino on AppEngine/Java. That should get you a long way

a server side mustache.js example using node.js

 ̄綄美尐妖づ 提交于 2019-12-20 09:23:10
问题 I'm looking for an example using Mustachejs with Nodejs here is my example but it is not working. Mustache is undefined. I'm using Mustachejs from the master branch. var sys = require('sys'); var m = require("./mustache"); var view = { title: "Joe", calc: function() { return 2 + 4; } }; var template = "{{title}} spends {{calc}}"; var html = Mustache().to_html(template, view); sys.puts(html); 回答1: I got your example working by installing mustache via npm, using the correct require syntax and

node.js running alongside Apache PHP?

吃可爱长大的小学妹 提交于 2019-12-20 08:02:33
问题 I am trying to get my head round node.js... I am very happy with my LAMP set up as it currently fulfils my requirements. Although I want to add some real-time features into my PHP app. Such as showing all users currently logged into my site and possible chat features. I don't want to replace my PHP backend, but I do want scalable real-time solutions. 1. Can I throw node.js into the mix to serve my needs without rebuilding the whole application server-side script? 2. How best could node.js