Git Product home page Git Product logo

server-harp's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

server-harp's Issues

Example: vhost router multi worker DEPRECATED

/*
	Usage Example:
dssrv.vhostrouter = require(express-domainrouter')
// Optain vhost config
dssrv.vhostrouter.locals.vhosts = worker.options.vhosts || [ 'default' ]
dssrv.vhostrouter.locals.vhosts.forEach(function(domain) {
    dssrv.debug('vhosts Registered: %s , %s', domain , 'replace')
    // dssrv.vhostrouter.locals.hostDictionary[domain] = replace
})
// dssrv.debug('vhosts Registered: %s , %s', 'default' , 'videoreplace')
// var apiAPP = require(worker.options.expressApps.bla.app)(worker.options.expressApps.bla.config)
// dssrv.vhostrouter.locals.hostDictionary['domain'] = apiAPP
*/


var express = require('express')
var vhostrouter = express('dssrv:worker:'+process.pid+':vhosts');
vhostrouter.locals.hostDictionary = vhostrouter.locals.hostDictionary || {}
vhostrouter.use(
	function replaceDevHosts(req, res, next) {
		// replace dev test hosts
		req.headers.originalHost = req.headers.Host || req.headers.host
		req.headers.Host = req.headers.originalHost.replace('.new','')
		req.headers.host = req.headers.originalHost.replace('.new','')
		req.headers.Host = req.headers.originalHost.replace('.local','')
		req.headers.host = req.headers.originalHost.replace('.local','')
		next()
	}, function vhost(req, res, next){
		  var debug = require('debug')('dssrv:worker:'+process.pid+':Vhost');
		  debug('VHOSTS EXEC: ' + JSON.stringify(req.headers))
		  // debug('VHOSTS EXEC: ' + JSON.stringify(req.app.locals.hostDictionary))
		  // console.log(req.app.locals.hostDictionary)
		  if (!req.headers.host) return next();
		  var host = req.headers.host.split(':')[0];
		  if (req.trustProxy && req.headers["x-forwarded-host"]) {
		    host = req.headers["x-forwarded-host"].split(':')[0];
		  }
		  var server = req.app.locals.hostDictionary[host];
		  if (!server){
		    server = req.app.locals.hostDictionary['*' + host.substr(host.indexOf('.'))];
		  }

		  if (!server){ 
		    server = req.app.locals.hostDictionary['default'];
		  }

		  // console.log(JSON.stringify(Vhost.hostDictionary))
		  // console.log()

		  if (!server) return next();
		  if ('function' == typeof server) return server(req, res, next);
		  // server.emit('request', req, res);
		  next()
	}
);

module.exports = vhostrouter

Documentation how to steal express apps with less Modifications :)

Importent Hooks

  • app._router.stack === []
    the Complet stack of registered middelware for a express app
  • express.Router().stack === []
    the Complet stack of registered middelware for a express app router

remove change reorder middelware as needed and export it as own app.

steal server demonstrates that powerfull via its use of done-serve ๐Ÿ‘ฏโ€โ™‚๏ธ

Integrate the C layer

We need to integrate our C Server directly into this

then default proxy to this and make config option for static files and other proxys directly in this.

so we default to this but! allow the user to configure something totally diffrent we don't block that!

So for every host reflect config in realtime! via a express direktspeed framework middelware

maybe document the mruby support but i think we should first finish experiment DIREKTSPEED-X985332-9 wich is about the direct nativ nodejs bindings.

Sum UP Features

TODO:

  • Automatic creates letsEncrypt certs and manages renew (by directory config Zero config mode)
  • Zero Config Mode
  • Per Project Zero Config Mode (package.json)
  • PreProcessor Chain Zero Config
  • Host stealjs / donejs Projects Production Ready Scale able
  • Outperforms NGINX by up to 200% in some deciplines 100% minimum.
  • hosting donejs projects live dev.host and production.host realtime sync to find compiling errors more fast
  • Option to auto preprocess ( build donejs projects if needed )
  • ngrok support out of the box
  • use same server for dev and production!
  • Advanced Modules
    • Neuronal Network self Scaling (Enterprise Feature)
    • Neuronal Network self Defence (Takes Aktion on Cyber Attacks Pro Active Solution)
    • Neuronal Network Fraud Detection.

Line out in deep features like:

  • http2 support cache aware push support

Dependency deprecation warning: cross-spawn-async (npm)

On registry https://registry.npmjs.org/, the "latest" version (v2.2.5) of dependency cross-spawn-async has the following deprecation notice:

cross-spawn no longer requires a build toolchain, use it instead

Marking the latest version of an npm package as deprecated results in the entire package being considered deprecated, so contact the package author you think this is a mistake.

Affected package file(s): package.json

If you don't care about this, you can close this issue and not be warned about cross-spawn-async's deprecation again. If you would like to completely disable all future deprecation warnings then add the following to your config:

"suppressNotifications": ["deprecationWarningIssues"]

New Concepts

Scan every folder under root/
find package.json if not exist assume default harp project

if finds package.json use it to find out if we are a express,feathers,donejs Application

if we are simply surfe that.

TODO: Find out what happens with individual listen stuff maybe make a master pollifil for that

Find a Solution for requiring External Dependencys from fs

steal-prerender could offer a middelware to link all modules from
the path

function npmls(cb) {
require('child_process').exec('npm ls --depth 0 --json', function(err, stdout, stderr) {
if (err) return cb(err)
cb(null, JSON.parse(stdout));
});
}
npmls(console.log);

npm.commands.ls(args, [silent,] callback)
console.log(Object.keys(require('./package.json').dependencies));

we will probally use rootRequire try catched

---- https://gist.github.com/branneman/8048520#comment-1412502
2. The Global

In your app.js:

global.__base = __dirname + '/';
In your very/far/away/module.js:

var Article = require(__base + 'app/models/article');


  1. The Wrapper

Courtesy of @a-ignatov-parc. Another simple solution which increases obviousness, simply wrap the require() function with one relative to the path of the application's entry point file.

Place this code in your app.js, again before any require() calls:

global.rootRequire = function(name) {
return require(__dirname + '/' + name);
}
You can then require modules like this:

var Article = rootRequire('app/models/article');


Install some module:

npm install app-module-path --save
In your app.js, before any require() calls:

require('app-module-path').addPath(__dirname + '/app');

or Use NODE_PATH=. or project root for require

hacky method

process.env.NODE_PATH = __dirname;
require('module').Module._initPaths();

I've been using symlinks with the following structure:

/node_modules
/package.json
/src
  /node_modules
    /client -> ../client
    /server -> ../server
    /shared -> ../shared
  /client
    /apps
      /main
        /test
          main.spec.js
        index.js
    /modules
      /foo
        /test
          foo.spec.js
        index.js
  /server
    /apps
    /modules
  /shared

it also solves the problem of not know where the modules come from because all app modules have client/server/shared prefixes in require paths

Add Rules:

# General Rule
Look on some defined requests if file is not there if we can find a alternate version for it via preprocessing and returning that

# Look on Some Defined Requests if the 



Add: Project Types

At present we have one Project Type: [Prerender/Harp]

  • Should add steal/donejs.
  • Should add nodejs
  • Should add php?
  • Should add docker?
  • Should add ?????

v2.0.0

Routing Multi Server using ssr.js

Directory Structure
Project Directory
|
|--| server
|--| ssr.js
|--| public
|--| package.json

Dependency Dashboard

This issue provides visibility into Renovate updates and their statuses. Learn more

Rate Limited

These updates are currently rate limited. Click on a checkbox below to force their creation now.

  • Update dependency chalk to v5
  • Update dependency commander to v9
  • Update dependency mime to v3
  • Update dependency mocha to v10
  • Update dependency node-fetch to v3

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

npm
package.json
  • steal git+https://github.com/stealify/steal/
  • compression ^1.6.1
  • debug ^4.0.0
  • done-serv git+https://github.com/donejs/done-serve
  • done-ssr-middleware git+https://github.com/donejs/done-ssr-middleware
  • express ^4.13.4
  • http-proxy ^1.13.2
  • infanticide ^1.0.1
  • donejs-spdy ^3.4.7
  • async ^2.0.1
  • commander ^4.0.0
  • download-github-repo ^0.1.3
  • dssrv-envy-json ^0.2.1
  • escape-html ^1.0.3
  • mime 2.0.3
  • fs-extra ^5.0.0
  • parseurl ^1.3.1
  • pause ^0.1.0
  • send ^0.15.0
  • chalk ^2.0.0
  • basic-auth ^2.0.0
  • cross-spawn-async ^2.0.0
  • q ^1.4.1
  • coveralls-send 0.0.2
  • dotdotdot 1.7.0
  • es6-promise 4.1.1
  • guide-automation 0.3.11
  • is-appveyor 1.0.0
  • istanbul 0.4.5
  • jshint 2.9.5
  • mocha 7.0.0
  • mocha-lcov-reporter 1.3.0
  • mockery 2.1.0
  • nixt 0.5.0
  • node-fetch 2.6.1
  • request 2.88.0
  • should 13.1.2
  • stream-when 1.0.0
travis
.travis.yml
  • node 4.5
  • node 5.0
  • node 7.5

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.