New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

human-lanterns

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

human-lanterns

Builds out basic CRUD scaffolding files for Express/Mongoose/EJS

latest
Source
npmnpm
Version
0.0.4
Version published
Maintainers
1
Created
Source

Human Lanterns v0.0.4

Builds out basic CRUD scaffolding files for Express/Mongoose/EJS with the following file stucture.

Usage

Install

npm install -g human-lanterns

Running

lanterns gen:modelname


app
	- views
	|	- modelname(s)
	|		- index.ejs
	|		- modelname.ejs
	|		- form.ejs
	|       - edit.ejs
	|       - new.ejs

	- routes
	|	- modelname(s).js (to be copied and deleted)

	- controllers 
	|	- modelname(s).js

	- models
	|	- modelname.js

If folders don't exist, they will be created, if they already exist, the files will be added to the existing folders.

Generators

Human Lanterns includes 5 generators. The main generator that creates all resoureces listed above and then a separate generator for views, routes, controllers, and models. Proper pluralization will be added to the modelname, so please use singular form when generating to avoided things like "clientss".

Main Generator

To generate a boilerplate model run:

lanterns gen:modelname

This runs all 4 generators; model, controller, routes, and views.

Model Generator

lanterns model:modelname

This creates app/models folder(s) if they don't already exist and creates a modelname.js file inside with barebone required title and body text field and commented out Mongoose schema types.

Controller Generator

lanterns controllers:modelname

This creates app/controllers folder(s) if they don't already exist and creates a names.js file inside with basic CRUD controllers.

Views Generator

lanterns views:modelname

This creates app/views folder(s) if they don't already exist and creates an ejs template for the basic CRUD controllers. See above for files created specifically.

Requirements

This is to be used with Express 4.

This uses a toSlug(); middleware function. Please add this to your middleware, or use this function in your pre-save hook

toSlug = function (value) {
  return value.toLowerCase().replace(/[ |_]/g, '-').replace(/[^\w-]+/g,'');
};

Todos

  • Clean up code
  • Check for existing files and prompt for overwrite

Acknowledgments

This package takes its name from my favorite movie, the Sun Chung classic Human Lanterns (1982) Trailer, Cool Ass Cinema Review - Word of warning - This movie is gruesome and violent but is completely unique and has an excellent visual style and choreography.

Sponsored By

Level Up Tuts - Youtube Channel

Keywords

scaffolding

FAQs

Package last updated on 19 May 2014

Did you know?

Socket

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.

Install

Related posts