
Security News
Node.js Homepage Adds Paid Support Link, Prompting Contributor Pushback
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.
generator-restgoose
Advanced tools
Modern, Lightweight, and Powerfull Rest API Code generator. Out-Of-Box NodeJS REST API Server generator built on top of Mongoose, Express, Cors, Passport, JWT and many more.
A custom-built Mongoose generator for Yeoman. The base project has been forked from afj176/generator-mongoose and has been updated with many new features, tests and tweaks to get you full fledged out-of-the-box NodeJS Express API Application up and running, Route vs Model Segregation and much more.
**Minimum Node Version : 9.x
Minimum NPM Version : 5.x
Minimum Yo Version : 2.x
**
First, install Yeoman and generator-restgoose using npm (we assume you have pre-installed node.js).
npm install -g yo
npm install -g generator-restgoose
$ mkdir server && cd server
$ yo restgoose
$ yo restgoose:schema "category|name:String"
$ yo restgoose:schema "item|name:String, price:Number, category:String>category"
the category:String>category
dneotes that category field will be created with string type, which referes to previously created schema 'category'.
$ yo restgoose:auth
do read the generated doc for auth before you start using it.
$ yo restgoose:deleteSchema "item" --force
$ npm start
If you would like to contribute, please refer to guidelines and a list of open tasks.
For more information, please refer to the Wiki page and FAQ
Try updating your yo to latest version. open a new issue in github for any problems you might face.
Seperation of Concern
Trick question. It's not a thing. It's this guy:
Basically, he wears a top hat, lives in your computer, and waits for you to tell him what kind of application you wish to create.
Not every new computer comes with a Yeoman pre-installed. He lives in the npm package repository. You only have to ask for him once, then he packs up and moves into your hard drive. Make sure you clean up, he likes new and shiny things.
$ npm install -g yo
While running through a leafy mongodb field he picked up mongoose.
Generator-Restgoose scaffolds all API Routes, API Objects ( Bussiness Logic), Schema Models, Test Cases, and even Documentation for you with full CRUD functionality.
To install generator-restgoose from npm, run:
$ npm install -g generator-restgoose
Finally, initiate the generator:
$ yo restgoose
It should output a file structure similiar to:
.bowerrc
.editorconfig
.jshintrc
api/
apiObjects/
config/
... db.js
... lib.js
docs/
public/
models/
routes/
... index.js
sdk/
test/
views/
bower.json
Gruntfile.js
package.json
Readme.md
markdown
formatted documentation of each Schema generated through the sub-generator.Put All Configurations in concerned environment in ./config. All of them inherit from global.
Don't forget to checkout the require('./config').util
module which contains many useful stuff (Json Validator, image to Base64 Converter, etc).
Use the Library as var l = require('../config').util;
( which generates with every sub schema).
Try to use l.p('Print something');
to log something. This will log to debug.log file.
Logging Two log files are served : debug.log and access.log.
All responses are valid jSend spec conformed JSON format.
npm start
npm test
Development mode
$ npm start
Creates all required Model, Controllers, test cases, routes and documentations for a particular Schema. Run the sub generator for schemas:
$ yo restgoose:schema "article|title:String,excerpt:String,content:String,published:Boolean,created:Date"
output:
You're creating a schema for article
With the fields: title,excerpt,content,published,created
create routes/article.js
create models/article.js
starting request to schematic for test mock data...
create test/test-article.js
create doc/article.md
Deletes all files (Model, APi Route, API Object, Doc, Test) for a particular schema. Run the sub generator for deleteschema:
$ yo restgoose:deleteSchema "article" --force
N.B. You need to use --force else y=Yeoman will continue asking you to overwrite each file.
output:
You're deleting all files for schema: article
force api/article.js
force apiObjects/article.js
force models/article.js
force docs/article.md
force test/test-article.js
Enabled Passport + Redis + JWT based Authentication and Authorization for your RESR API server.
$ yo restgoose:auth "auth"
N.B. Run this before creating user model and auth controllers or else, they will be overwritten.
output:
Instantiating Authentication ...
create api/auth.js
create apiObjects/auth.js
create models/user.js
create middlewares/passport.js
create docs/auth.md
create routes/sampleauth.js
You should checkout the docs/auth.md
after issuing this command for complete reference.
Yeoman has a heart of gold. He's a person with feelings and opinions, but he's very easy to work with. If you think he's too opinionated, he can be easily convinced.
If you'd like to get to know Yeoman better and meet some of his friends, Grunt and Bower, check out the complete Getting Started Guide.
WIP
Create Test for auth and delete sub-generators
MIT
Copyright 2016 - 2018 Abhishek Deb
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
:warning: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
[ 15 April 2020 ] v0.5.95
Long awaited fixes and updates
FAQs
Modern, Lightweight, and Powerfull Rest API Code generator. Out-Of-Box NodeJS REST API Server generator built on top of Mongoose, Express, Cors, Passport, JWT and many more.
The npm package generator-restgoose receives a total of 30 weekly downloads. As such, generator-restgoose popularity was classified as not popular.
We found that generator-restgoose demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.
Research
North Korean threat actors linked to the Contagious Interview campaign return with 35 new malicious npm packages using a stealthy multi-stage malware loader.
Research
Security News
The Socket Research Team investigates a malicious Python typosquat of a popular password library that forces Windows shutdowns when input is incorrect.