All Projects β†’ cdimascio β†’ Generator Express No Stress

cdimascio / Generator Express No Stress

Licence: mit
πŸš‚ A Yeoman generator for Express.js based 12-factor apps and apis

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Generator Express No Stress

Generator Express No Stress Typescript
πŸš„ A Yeoman generator for Express.js based 12-factor apps and apis using Typescript
Stars: ✭ 297 (-44.38%)
Mutual labels:  swagger, openapi, openapi3, expressjs, yeoman-generator
Express Openapi Validator
πŸ¦‹ Auto-validates api requests, responses, and securities using ExpressJS and an OpenAPI 3.x specification
Stars: ✭ 436 (-18.35%)
Mutual labels:  openapi, openapi3, express, expressjs
Express Jsdoc Swagger
Swagger OpenAPI 3.x generator
Stars: ✭ 69 (-87.08%)
Mutual labels:  swagger, openapi, openapi3, expressjs
Create Openapi Repo
πŸ€– Generator for GH repo to help you manage the OpenAPI definition lifecycle
Stars: ✭ 513 (-3.93%)
Mutual labels:  swagger, openapi, openapi3
openapi-schema-validator
OpenAPI schema validator for Python
Stars: ✭ 35 (-93.45%)
Mutual labels:  swagger, openapi, openapi3
fastify-openapi-glue
A plugin for Fastify to autogenerate a configuration based on a OpenApi(v2/v3) specification.
Stars: ✭ 94 (-82.4%)
Mutual labels:  swagger, openapi, openapi3
Mockoon
Mockoon is the easiest and quickest way to run mock APIs locally. No remote deployment, no account required, open source.
Stars: ✭ 3,448 (+545.69%)
Mutual labels:  swagger, openapi, openapi3
Safrs
SqlAlchemy Flask-Restful Swagger Json:API OpenAPI
Stars: ✭ 255 (-52.25%)
Mutual labels:  swagger, openapi, openapi3
Openapi.tools
A collection of Editors, Linters, Parsers, Code Generators, Documentation, Testing
Stars: ✭ 257 (-51.87%)
Mutual labels:  swagger, openapi, openapi3
Swagger Ui
Swagger UI is a collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.
Stars: ✭ 21,279 (+3884.83%)
Mutual labels:  swagger, openapi, openapi3
Practicalnode
Practical Node.js, 1st and 2nd Editions [Apress] πŸ““
Stars: ✭ 3,694 (+591.76%)
Mutual labels:  express, expressjs, express-js
Studio
The modern editor for API Design and Technical Writing.
Stars: ✭ 459 (-14.04%)
Mutual labels:  swagger, openapi, openapi3
Serverless Express
Run Node.js web applications and APIs using existing application frameworks on AWS #serverless technologies such as Lambda, API Gateway, Lambda@Edge, and ALB.
Stars: ✭ 4,265 (+698.69%)
Mutual labels:  express, expressjs, express-js
shipengine-openapi
The official OpenAPI 3.0 definitions for ShipEngineβ„’
Stars: ✭ 13 (-97.57%)
Mutual labels:  swagger, openapi, openapi3
openapi-schemas
JSON Schemas for every version of the OpenAPI Specification
Stars: ✭ 22 (-95.88%)
Mutual labels:  swagger, openapi, openapi3
Full Stack Fastapi Couchbase
Full stack, modern web application generator. Using FastAPI, Couchbase as database, Docker, automatic HTTPS and more.
Stars: ✭ 243 (-54.49%)
Mutual labels:  swagger, openapi, openapi3
Awesome Openapi3
😎 A list of awesome projects related to OpenAPI 3.0.x, curated by the community
Stars: ✭ 469 (-12.17%)
Mutual labels:  swagger, openapi, openapi3
Openapi Codegen
OpenAPI 3.0 CodeGen plus Node.js minus the Java and emojis
Stars: ✭ 224 (-58.05%)
Mutual labels:  swagger, openapi, openapi3
Spot
Spot is a concise, developer-friendly way to describe your API contract.
Stars: ✭ 230 (-56.93%)
Mutual labels:  swagger, openapi, openapi3
Dredd
Language-agnostic HTTP API Testing Tool
Stars: ✭ 3,770 (+605.99%)
Mutual labels:  swagger, openapi, openapi3

πŸš‚ generator-express-no-stress

Codacy Badge All Contributors

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 using an OpenAPI 3 or Swagger 2 spec, environment based config with dotenv, and linting with ESLint.

GitHub stars Twitter URL

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 request and response validation, structured logging, environment driven config, and more. Simply run the generator and smile :-D

Here's what you get!

Install

Requires Node 8 or greater

npm install -g yo generator-express-no-stress
  • See here for use with Yarn and/or Docker
  • See here for Node 6 support

Scaffold

yo express-no-stress myapp
cd myapp

Run

Run in development mode:

npm run dev

Package and run in production mode

npm run compile
npm start

Test

npm test

Debug

Run one of the following, then attach your favorite inspector e.g. VSCode:

# debug the server
npm run dev:debug

# debug the tests
npm run test:debug

Try it!


Usage: CLI

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

Usage: Project

The sections below describe all usage options available once the project is generated/scaffolded.

npm targets

Target Description
npm run dev Run in development mode
npm run dev:debug Debug in development mode
npm run test Run tests
npm run test:debug Debug tests
npm run lint View a listing of all errors discovered by the linter
npm run lint:fix Fix all errors discovered by the linter
npm run compile Transpile source code for production use
npm start Run the in production mode. *Requires running npm run compile first

Debug in VSCode

Add these contents to your .vscode/launch.json file

Debug in WebStorm

  1. Start debug in development mode via npm run dev:debug
  2. From the "Run" menu, select "Debug"
  3. Select "Edit Configurations..."
  4. From the list of Templates on the left side of the dialog, select "Attach to Node.js/Chrome"
  5. Press the "Debug" button to attach the WebStorm debugger

Deploy to the Cloud

e.g. CloudFoundry

cf push myapp

Use Yarn

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

# run in development mode
yarn run dev

# run in production mode
yarn run compile
yarn start

# test
yarn test

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

  • ESLint - a pluggable linting utility for JavaScript and JSX

    Choose from the following ESLint lint rules:

    • Airbnb - A mostly reasonable approach to JavaScript
    • Prettier - Prettier is an opinionated code formatter
  • 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 request validation
  • API response validation (OpenAPI 3 only. Disabled by default)
    • To enable set OPENAPI_ENABLE_RESPONSE_VALIDATION=true in .env

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
        example: no_stress

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: an example
          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 example to retrieve
          type: integer
      responses:
        200:
          description: Return the example with the specified id
        404:
          description: Example not found

  /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 and provides two choices, Airbnb or Prettier.

To add your own ESLint customizations, edit.eslintrc.json.

Note that the Airbnb variant provides a slightly modified Airbnb base configuration.

FAQ

Q: How do I modify the example API and make it my own?

A: There are two key files that enable you to customize and describe your API:

  1. server/routes.js - This references the implementation of all of your routes. Add as many routes as you like and point each route your express handler functions.
  2. server/common/api.yaml - This file contains your OpenAPI spec. Describe your API here. It's recommended that you to declare any and all validation logic in this YAML. express-no-stress-typescript uses express-openapi-validator to automatically handle all API validation based on what you've defined in the spec.

Q: I previously generated an app, but I want to change the API root. How do I do this?

A: You need to make to small changes

  1. Modify server/routes.js
   // Change your original path e.g. /api/v1/examples, to:
   app.use('/api/v2/examples', examplesRouter);
  1. Modify server/common/api.yaml and update the api root:
  # Change e.g. /api/v1 to /api/v2
  servers:
  - url: /api/v2   

License

MIT

Buy Me A Coffee

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Jaime Leonardo Suncin Cruz

πŸ’»

Daniel Bornstrand

πŸ’»

Jason Corns

πŸ“–

Frank Calise

πŸ“–

Daisuke Tsuji

πŸ“–

Sangbeom Han

πŸ“–

Mike Lay

πŸ“–

jodejar214

πŸ’»

This project follows the all-contributors specification. Contributions of any kind welcome!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].