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 🙏

© 2026 – Pkg Stats / Ryan Hefner

generator-angular-proxy

v1.1.2

Published

Creates AngularJS project with possibility to write your proxy server and to use remote server as your backend.

Downloads

47

Readme

generator-angular-proxy

Yeoman generator that creates AngularJS project with possibility to write your proxy server and to use remote server as your backend.

General idea

If you are frontend developer with someone else writing the backend, this is the generator for you. Write only frontend code and use remote backend. If you want, you can mock some requests, until backend is ready.

It also supports Maven build if you want (you will be prompted with a question).

Usage

Install yo, gulp-cli, bower, and generator-angular-proxy:

npm install -g yo gulp-cli bower generator-angular-proxy

Make a new directory, and cd into it:

mkdir my-new-project && cd $_

Run yo angular-proxy passing an app name:

yo angular-proxy [app-name]

You will be prompted with a few questions:

Page title (it will be displayed in tab)? ()
Project description (it will be set to meta description)? ()
Which angular version (1.x version) you want to use? (latest)
Do you want to use Bootstrap? (Y/n) (Y)
Do you want to use Bootstrap LESS (it will be compiled into your css, but you will be able to use it's variables)? (Y/n) (Y) // in case you want to inherit/use Bootstrap LESS variables, select yes, otherwise it will use Bootstrap's css and just concatenate with other vendors
Do you want to use angular-resource? (Y/n) (Y) // installs angular-resource
Do you want to use angular-cookies? (Y/n) (Y) // installs angular-cookies
Do you want to use angular-sanitize? (Y/n) (Y) // installs angular-sanitize
Do you want to use Angular UI Router (https://github.com/angular-ui/ui-router)? (Y/n) (Y) // otherwise, you will have to use AngularJS's native routing
Are you going to support unit tests? (Y/n) (Y) // it will generate karma.conf.js and test examples
Are you going to use Maven for packaging? (Y/n) (Y) // in case you select yes, you will get some Maven specific questions which will be used for pom.xml

  Enter groupId:
  Enter artifactId:
  Enter name:
  Enter final name:
  Enter node version (vX.X.X, https://nodejs.org/en/download/releases/): v5.9.1
  Enter NPM version (X.X.X, https://github.com/npm/npm/releases): 3.7.0

Development

After you answered all the questions it will install NPM and Bower dependencies.

Also, you will get examples of routing and unit tests inside the core module.

Modules

Application should be developed with the modules (separated by the functionality) in mind. Each time you add new module, you will have to create module.js iside the route folder of the module which is responsible for registering it (see core example).

Also, add that module name into app.js to load it.

Running your project

Development mode

gulp serve

Production mode

gulp serve:dist

Running/writing tests

Tests are using Karma runner and Jasmine assertion library.

You have got example of the test together with the generated project to see how write the basic test.

gulp test
gulp test:auto // runs the test and runs the constantly (each time you change file it will re-run the tests)

Mocking servers

There is a server folder delivered together with your frontend project where you can mock routes if you want.

server
----api
--------testing
------------index.js
----config
--------environment
--------conf.js
--------express.js

The imporant thing here is conf.js and mocked-routes.js.

Inside conf.js you will define where your remote backend will be (targetServer) and on which URL rest is (restApi) and if you want to use mock server, you can define on which port to be started. If you need only remote backend, just comment mockServer part.

// conf.js

// where real server will be
exports.targetServer = {
    ip : 'http://127.0.0.1',
    port : 3000,
    restApi : '/api' // used only in case ONLY targetServer is present (otherwise, mock server will put entire request through)
}

// where mocked server will be
// if you want to go directly to server each time, comment out below
exports.mockServer = {
    port : 3002,
    ip : '0.0.0.0',
    restApi : '/api'
}

Inside mocked-routes.js you just have to list files which you want to load to behave as your mocked routes:

module.exports = function(app) {
    require('./api/testing')(app);
};

There is an example inside api/testing/index.js how to mock some of the routes.

Using only mock server

You can develop your frontend without any backend.

e.g. perspective of frontend developer

Backend hasn't start development yet, but you already agreed on some API so let's mock that API.

mock_only

/server/config/conf.js

// where mocked server will be
exports.mockServer = {
    port : 3002,
    ip : '0.0.0.0',
    restApi : '/api'
}

Using only target server

You can develop your frontend by just using your frontend project and using remote backend.

e.g. perspective of frontend developer:

I have only frontend to develop, I don't have to mock and API endpoint and I have backend developer developing for me HTTP endpoint on his own (remote) machine. We agreed on API to be on /api endpoint

target_only

/server/config/conf.js

// where real server will be
exports.targetServer = {
    ip : 'http://www.outside.com,
    port : '',
    restApi : '/api'
}

Using mock and target server

You can develop your frontend by just using your frontend project and using remote backend, but in case remote backend is still missing some API you can write it inside your project.

e.g. perspective of frontend developer I realized my backend developer will need more time to develop some feature so I'll quickly mock one API endpoint (/api/mockedUrl).

both

/server/config/conf.js

// where real server will be
exports.targetServer = {
    ip : 'http://www.outside.com,
    port : '',
    restApi : '/api'
}

// where mocked server will be
exports.mockServer = {
    port : 3002,
    ip : '0.0.0.0',
    restApi : '/api'
}
mocked-routes.js

module.exports = function(app) {
    require('./api/mockmodule')(app);
};
/api/mockmodule.js

module.exports = function(app) {
    app.get('/api/mockedUrl', function(req, res) {
        res.json({ items: [
            {
                id : 1,
                item : 'Item 1'
            },
            {
                id : 2,
                item : 'Item 2'
            }
        ] });
    });
};