Giter Site home page Giter Site logo

mrramezanzad / xpg Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 404 KB

Best Express CLI package and API generator which helps you make apps from scratch by provided boilerplate and add services and controllers by fast and easy CLI commands.

JavaScript 96.88% EJS 3.12%
express expressjs cli generator generater api api-rest restful

xpg's Introduction

Express Rest API & Boilerplate Generator

Create an app from scratch with Boilerplalte or Generate services and controllers by simple CLI commands based on latest conventions of coding.

We have tried our best to use Restful conventions in our boilerplate and codes.
boilerplate

Features

  • a Boilerplate to start a project from scratch with neccessary configs and structure.

  • CLI Commands to simply create project parts: services, controllers or even whole project structure.

    we will try to make it much better in futrue, any suggestions would be appreciated by all users.

  • Error Handling System.

  • pre configed dotenv structure to bring environment variables.

  • and more hidden features like async handler.

Installation

In your Terminal/CMD enter npm i -g xpg then you can use this package anywhere by CLI commands.

CLI Commands

  • makes a new app xpg -n [app name]

    this command will create a complete project based on model-view-controller and services which is api based and all layers are seperated.

  • makes both controller and service xpg [model name]

  • generate controller xpg -c [controller name]
    controller

  • generate service xpg -s [service name]
    controller

xpg -h will show a list of commands .

Async Handler

  • async handler function will wrap all controllers so you will never need to use try-catch in any of your express apps.
    async handler

Error Handling System

  • very flexible error handling system.
    configs
    this system has been designed and covered all required status codes for your errors. configs
    Methods :

    • badRequest
    • unAuthorized
    • forbidden
    • notFound
    • internal
    • badGateway
    • unAvailabe
    • gatewayTimeout

    Usage :

    • import any of static methods from error directory inside ApiError file. \errors\ApiError.js
    • call imported method and pass your custom message or it will use default message.
      configs

Hidden Features

  • pre configured environment variable configurations for development and production which uses dotenv package.
    configs
  • other pre configurations like:
    • session & cookie parser
    • mongodb database connection by mongoose
    • logger for routes that uses morgan
    • EJS view engine
    • static files directory in public folder
    • extended urlencoded
      extra configs

note: this is an open source project, feel free to clone.
if you have any suggestions we appreciate you make an issue.

Hope You Enjoyed Using This Package ❤️❤️❤️.

xpg's People

Contributors

mrramezanzad avatar

Stargazers

Roman avatar Andrew Johnson avatar

Watchers

James Cloos avatar  avatar

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.