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

generator-angular-rest

v0.3.1

Published

Generate an angular 1.5 scaffolding, ready for REST API, with a basic mocking setup. Based on John Papa's Style Guide.

Downloads

28

Readme

Generator Angular Rest

npm npm

A micro AngularJS scaffolding for start projects with mocking and routing modules ready,

based on this Best Practice angular-styleguide made by johnpapa.

Based on this Angular Boilerplate.

News

As soon as possible will be avaiable new modules:

angular-rest:cordova

Will geneate an app compatible with ngCordova

angular-rest:module-cordova

Will geneate a module compatible with ngCordova

angular-rest:factory-cordova

Will geneate a factory compatible with SQLite operations (for ngCordova)

angular-rest:repository-cordova

Will generate a factory that will handle database queries

Installation

First, install Yeoman and angular-rest using npm (we assume you have pre-installed node.js).

    $ npm install -g yo
    $ npm install -g generator-angular-rest

Then generate and start your new project:

    $ mkdir myNewproject
    $ cd myNewproject
    $ yo angular-rest
    $ npm run serve

Running Generator:

Generators for module, directive, factory and filter

	$ yo angular-rest:module
	$ yo angular-rest:component
	$ yo angular-rest:factory
	$ yo angular-rest:filter

Set up environment

For developing env:

With watch and live reload for js and css (or sass)

	$  npm run serve

For production env:

Simply return minified code and optimizated images

	$  npm run prod

What does the module create?

angular-rest

Create the folder structure, based on Angular Boilerplate. For more info goes to the repo.

angular-rest:module

Generate a module with mocking and routing core functionality.

The folder will be pushed here

src/app/modules/
|
|___delete
|    |___name.delete.js
|    |___name.delete.html
|
|___index
|    |___index.js
|    |___name.index.html
|
|___show
|    |___show.js
|    |___name.show.html
|
|___store
|    |___name.store.js
|    |___name.store.html
|
|___update
|   |___name.update.js
|   |___name.update.html
|
|___name.mock.js
|___name.route.js
|___name.factory.js
|___name.validator.js

The core modules are name.factory.js, name.mock.js, name.route.js (where name is the module name).

name.factory.js contains all the http request for the backend.

name.mock.js generate a fake response (also simulating errors).

name.route.js generate a routing for the module.

name.validator.js generate a validation file for the module's model. Use valdr validation

All the other directory delete, index, show, store and update are the actions avaiable for the module.

Each action contains a controller (name.action.js) and a view (name.action.html).

angular-rest:component

Generate a directive with 'controller' and 'link' functions.

src/app/shared/components/
|
|___name-component.js
|___name-component.html

There are 2 files.

The name-component.html (where name is the name of the component) for the template that will be used by the directive, and the name-component.js will contains the directive.

angular-rest:factory

Generate a basic factory.

src/app/shared/factories/
|___name.factory.js

Will be generated a name.factory.js (where name is the name of the factory) file that will contain a factory with a simple init function (will log a string).

angular-rest:filter

Generate a basic filter.

src/app/shared/filters/
|___name.filters.js

Will be generated a name.filters.js(where name is the name of the filter) file that will contain a filter.