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-2-crud

v0.6.0

Published

This app generate a CRUD for Angular2

Downloads

20

Readme

generator-angular-2-crud

NPM version Build Status Dependency Status

This npm generate a CRUD for Angular 2 using a data model definition and best practices

Installation

First, install Yeoman and generator-angular-2-crud using npm (we assume you have pre-installed node.js). Ensure you're running the latest versions Node v4.x.x+ (or v5.x.x) and NPM 3.x.x+

npm install -g yo
npm install -g generator-angular-2-crud      <------ is not WORKING, we have an open issues on 'yo' repository

To run your new project you need install the next packages:

npm install --global typescript
npm install --global webpack
npm install --global webpack-dev-server

Installing generator-angular-2-crud from scratch

1 - npm install -g yo

2 - Delete the globally installed generator (if was installed by mistake): npm uninstall -g generator-angular-2-crud

3 - go into your npm root repo cd `npm -g root`

4- Clone generator-angular-2-crud repo git clone https://github.com/gorums/generator-angular-2-crud.git

5- cd generator-angular-2-crud

6- npm install

7- return to your directory where you have defined the dataModel.json file and generate the crud : yo angular-2-crud

6- Enjoy!

DataModel

Access to the project folder and create a file named dataModel.json

mkdir my_new_crud && cd my_new_crud
touch dataModel.json
  • Example of dataModel.json
 {
    "Doctors": {
        "Id": { "key": "true" },
        "Name": { "type": "string", "require": "true" },
        "Address": "string",
        "Available": "boolean"        
    },
    "Patients": {
        "Id": { "key": "true" },
        "Name": { "type": "string", "require": "true" },
        "Address": "string",
        "Age": "number",
        "History": {"type": "string", "textArea": "true" },
        "DoctorId": { "referent": "Doctors", "render": "Name" }
    },
    "relativeURI": "/api"
}
  • key: Define a field as key

  • type: Allow string, boolean and number

  • require: Define a field as require for validation

  • referent: Define the relation

  • render: Define what field show in the relation, in the example above it is going to render Doctor.Name instance of DoctorId

  • relativeURI: Define the relative URI. An example using /api http://127.0.0.1:3000/api/myentity

without relativeURI the URL is going to be http://127.0.0.1:3000/myentity

  • textArea: Render the field as textarea

Generation

Then generate your new project into your project folder with the dataModel.json defined:

yo angular-2-crud

Run

Now you can run your new CRUD

npm start

http://127.0.0.1:3000 or http://0.0.0.0:3000

Server Mock Generator

Instance we can generate a server mock in NodeJs/ExpressJs

yo angular-2-crud:server

Run Server Mock

Now you can run your server NodeJs mock and test your Angular 2 CRUD with fake data.

cd server
npm start

Thanks for help

@smansri

@augustbering

License

MIT © gorums