npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

spa-proxy

v1.0.8

Published

HTTP Proxy For MAVEN-PROJECT (Proxy for JEE-Rest, Static for Resources)

Downloads

1,018

Readme

spa-proxy

SPA Proxy FrondEnd

This module add proxy for MAVEN PROJECT

Required:

  1. Project Maven: Any Project with same structure:
 project-pom/
   project-ejb/    <!--  Other Project -->
   project-xxx/    <!--  Other Project -->
   project-asset/  <!--  Web Project -->
   project-web/    <!--  Web Project -->
   gulpfile.js     <!--  Gulp File   -->

Used:

1. Add in devDependencies

"spa-proxy": "^1.0.8"

2. Create a gulpfile.js

var gulp = require('gulp');
var bs = require('browser-sync').create();
var spa = require('spa-proxy')('maven-project-web', '/path-deploy');

Create Gulp Task

//Create a Browser Sync Server
gulp.task("server", function () {
		var proxyURL = 'http://127.0.0.1:8080/'; //JEE Server
		bs.init({
				startPath: '/',
				server: spa.createServer(proxyURL),
				online: false,
				browser: ["firefox"],
				port: 3000
		});
});
//Create a watch change
gulp.task("watch", function () {
		var _watch = spa.createWatchPath();
		console.log("WATCH FOR: ", _watch);
		gulp.watch(_watch, function () {
				bs.reload();
		});
});
//Create a default task
gulp.task("default", ["watch", "server"]);

3. Custom Configurarion

spa = require('spa-proxy')('#MAVEN-PROJECT-WEB#', '#CONTEXT-PATH#')  

Example:

 example-pom/
   example-ejb/    <!--  Other Project -->
   example-xxx/    <!--  Other Project -->
   example-asset/  <!--  Web Project -->
   example-web/    <!--  Web Project -->
   gulpfile.js     <!--  Gulp File   -->

MAVEN POM: example-pom MAVEN WEB: example-asset MAVEN WEB: example-web

spa = require('spa-proxy')('example-web', '/path/demo')

Include other Maven Project

spa.mavenProject.add('example-asset', '/path/to/asset'); // Project in same directory
spa.mavenProject.add('other-project', '/path/to/other', '/path/absolute'); // Project in other directory

4. Custom Directory

Default Directory to static

var spa = require('spa-proxy')('maven-project-web', '/path-deploy');
console.log(' No Proxy Dir: ', spa.noProxy.get()); //part, view, ctrl, css, js
spa.noProxy.add('asset');
console.log(' No Proxy Dir: ', spa.noProxy.get()); //part, view, ctrl, css, js, asset
spa.noProxy.set(['css', 'asset']);
console.log(' No Proxy Dir: ', spa.noProxy.get()); //css, asset

This structure is based by AngularJS and HTML Basic Concept

  • The 'ctrl' directory replace to 'controllers' of angularjs
  • The 'view' directory replace to 'views' of angularjs
  • The 'part' directory groups of common html
  • The 'css' directory groups files 'css'
  • The 'js' directory groups files 'js'

Include Maven Project

var spa = require('spa-proxy')('maven-project-web', '/path-deploy');
console.log(' Maven Projects: ', spa.mavenProject.get()); 
//{project: 'maven-project-web', context: '/path-deploy', path: '.'}
spa.mavenProject.add('other-maven-web', '/other-path', '/root/path');
console.log(' Maven Projects: ', spa.mavenProject.get()); 
//{project: 'maven-project-web', context: '/path-deploy', path: '.'}
//{project: 'other-project-web', context: '/other-path', path: '/root/path'}