Coder Social home page Coder Social logo

jgen's Introduction

jGen

A cli to create node project structure

NOTE: This module is under development hence not in npmjs.com. npm install jgen won't work.

  1. Clone this repository on your system.
  2. Open this folder location in your terminal
  3. do
      $ npm install -g
    

Getting Started

Create a new folder where you want to setup your project. Open this folder in your terminal and execute

  $ jgen init

Enter your project name and other details as you generally do while npm init.

The whole project gets setup after this which includes

  1. Creating file-folder structure
  2. Writing all the files
    • Create package.json
    • Create .gitignore
    • Create project files
  3. Initialise git repository
  4. Add git remote if specified
  5. Install all dependencies

Starting app

Start your app using

  $ npm start

Generating Models

To create models in your app use

  $ jgen model <model_name>

It will create the basic CRUD(Create, Read, Update, Delete) routes. All the routes can be found in /tmp/routes.html

Features

  1. To require any file located inside modules/ folder, you can use

      var UserOperations = requireFromModule('users/operations');

    instead of writing the absolute file location.

  2. App is created using express.js on MongoDB using mongoose client.

  3. successJSON(data) and errorJSON(errorCode, err, message) functions are provided for sending api responses to the client. Use

      res.json(successJSON(result));

    It will send a json object as:

    {
      "success": true,
      "data": "<result>"
    }
  4. Java inspired logger (jlogger) is integrated by default. Log directly anywhere from the app using Log.e(), Log.w(), Log.i() or Log.d().

##Backward Compatibility Due to the library still being in development, incase you are pulling the repository after initialising project, it is recommended to run

$ jgen update

to incorporate new featues.

Todo

  1. Add redis caching
  2. Add logs for database transactions
  3. mocha test scripts for main server per model
  4. including api authentication

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.