Coder Social home page Coder Social logo

camilo5972 / generator-express-no-stress Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cdimascio/generator-express-no-stress

0.0 1.0 0.0 3.19 MB

A Yeoman generator for Express.js based 12-factor apps and apis

License: MIT License

JavaScript 62.27% HTML 37.73%

generator-express-no-stress's Introduction

generator-express-no-stress

Codacy Badge

Create awesome Express.js applications with best of breed tech including ES.next via Babel.js, structured logging with Pino, API validation and interactive documentation via Swagger, environment based config with dotenv, linting with ESLint, and Backpack powered builds.

generator-express-no-stress gets you up and running in seconds. It's ridiculously easy to configure. Heck, just take the defaults. Start it. Write code.

This generator scaffolds a fully functioning REST API server complete with interactive documentation, API validation, structured logging, environment driven config, and more. Simply run the generator and smile :-D

Install

Requires Node 6 or greater

npm install -g yo generator-express-no-stress

Scaffold

yo express-no-stress myapp

Run

Run in development mode:

cd myapp
npm run dev

Run in production mode:

npm run compile
npm start

Deploy to the Cloud

e.g. CloudFoundry

cf push myapp

Test

npm test

Debug

Run npm run debug and attach your favourite inspector!

Try it!

Use Yarn

# scaffold
yo express-no-stress myapp --yarn 

# start
cd myapp
npm start

CLI Options

yo express-no-stress [appname] [--yarn] [--docker]
Option default Description
appname myapp The application folder
--yarn Use the yarn package manager, instead of npm
--docker Install Docker artifacts including a Dockerfile

What you get!

  • Express.js - Fast, unopinionated , minimalist web framework for Node.js
  • Babel.js - Use new syntax, right now without waiting for support
  • Pino - Extremely fast node.js logger, inspired by Bunyan. It also includes a shell utility to pretty-print its log files
  • dotenv - Loads environment variables from .env for nodejs projects
  • Backpack - a minimalistic build system for Node.js projects.
  • ESLint - a pluggable linting utility for JavaScript and JSX
  • Swagger - is a simple yet powerful representation of your RESTful API.
  • SwaggerUI - dynamically generate beautiful documentation and sandbox from a Swagger-compliant API

API Validation

Simply describe your APIs with Swagger and automagically get for free:

  • Interactive documentation
  • API validation

Interactive API Doc

API Validation!

Oops! I the API caller forgot to pass a name field, no stress, we've got this!

Structured Logging

Structured logging out of the box!

raw

pretty

Structured logging pretty printed by default - great for dev!

API Validation Example

Simply describe your APIs with Swagger and automatically get:

  • API request validation
  • Interactive documentation

example

Swagger API spec

swagger: "2.0"
info:
  version: 1.0.0
  title: myapp
  description: My cool app
basePath: /api/v1
tags:
  - name: Examples
    description: Simple example endpoints
  - name: Specification
    description: The swagger API specification

consumes:
  - application/json
produces:
  - application/json

definitions:
  ExampleBody:
    type: object
    title: example
    required:
      - name
    properties:
      name:
        type: string
        description: The example name

paths:
  /examples:
    get:
      tags:
        - Examples
      description: Fetch all examples
      responses:
        200:
          description: Returns all examples
    post:
      tags:
        - Examples
      description: Create a new example
      parameters:
        - name: example
          in: body
          description: number of items to skip
          required: true
          schema: 
            $ref: "#/definitions/ExampleBody"
      responses:
        200:
          description: Returns all examples

  /examples/{id}:
    get:
      tags:
        - Examples
      parameters:
        - name: id
          in: path
          required: true
          description: The id of the entity to retrieve
          type: integer
      responses:
        200:
          description: Return the example with the specified id
        404:
          description: Example not 

  /spec:
    get:
      tags:
        - Specification
      responses:
        200:
          description: Return the API specification

Invoke a POST request via the Interactive doc

Linting

express-no-stress uses ESLint with a slightly modified AirBnb base configuration. See .eslintrc.json to make modifications.

License

MIT

generator-express-no-stress's People

Contributors

cdimascio avatar amygdaloideum avatar

Watchers

Camilo Henao 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.