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

endpoints-angular-client-generator

v0.0.1-6

Published

NodeJS module that generates a pure AngularJS javascript client based on your google endpoints service

Downloads

26

Readme

endpoints-angular-client-generator Build Statusnpm version

NodeJS module that generates a pure AngularJS javascript client based on your google endpoints service

Why

Let me start by saying that there is nothing wrong with google client.js! It is way better than the code this tool generates! Just include https://apis.google.com/js/client.js and you are done!

So why, why, why! Well the integration of that client with "the angular way" is not ideal (IMO)

  • It doesn't use $http so the whole "handling of http errors, etc" doesn't work
  • It doesn't use $q so you need to $q.when everything somehow
  • You need to hook up loading of client with startup of angular app (easy to get wrong)
  • Impossible to use with protractor (as protractor waits for $http and $timeout)
  • When I work on Bus, Tram or taxi with my laptop I need to go on 3G to be able to develop (to download client.js)
  • I ended up wrapping the client usage with an angular service, so every time I changed the backend (google endpoints) I had to go and change my hand-crafted wrapper.

So, I decided to try to simplify my life... Let's see how it evolves!

Status

This is still in very early stages... Documentation is poor, features are few... It does what I need it to do.

Things I would like it to do:

  • Support authentication (Only API key supported atm)
  • Integrate with ng-resource
  • Generate documentation regarding data structures (request object, etc)
  • Maybe generate types for the schemas on the rest description document...

Installing

Install using npm

npm i endpoints-angular-client-generator -g

Usage

Here's what it can do for you:

$ endpoints-angular-client-generator -h

  Usage: endpoints-angular-client-generator [options] -d <file> -o <file>

  Options:

    -h, --help                  output usage information
    -V, --version               output the version number
    -d, --document <file>       Read discovery document from <file>
    -o, --output-dir <dir>      Write generated code files to <dir>
    -s, --split-module          Split generated code into two files, one for the module another for provider
    -m, --module-name <name>    Override default module name to be "angular.module(<name>)"
    -p, --provider-name <name>  Override default provider/service name to be "angular.module().provider(<name>)"

Examples

Have a look at generate-examples.sh and how I used the output in examples folder. I'm getting it to work first, then I will write more examples and maybe publish that directory somehow.