• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

SystangoTechnologies/koach-javascript: Production ready Koa2 boilerplate.

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

SystangoTechnologies/koach-javascript

开源软件地址:

https://github.com/SystangoTechnologies/koach-javascript

开源编程语言:

JavaScript 99.5%

开源软件介绍:

KOACH

KOACH

Production ready boilerplate for building APIs with koa2 using mongodb as the database and http/2 as the communication protocol.

Description

This project covers basic necessities of most APIs.

  • Authentication (passport & jwt)
  • Database (mongoose)
  • Testing (mocha)
  • http/2 support for websites and apis
  • Doc generation with apidoc
  • linting using standard
  • Contains two versions of API

Please note, if you are planning to use this boilerplate for creating a web application then the 'https' protocol should be used to access its pages.

Visit https://localhost:3000/ to access the root page.

Requirements

  • node = v10.15.3
  • MongoDB

.env Configuration

To simulate environment variables in Dev environment, please create .env file at the root location and define the following properties -

NODE_ENV=production                                 // Node environment development/production
PORT=8000                                           // Server Port
SESSION=0.0.0.0                                     // secret-boilerplate-token
JWT_SECRET=This_Should_be_32_characters_long        // Jwt secret
DATABASE_URL=mongodb://localhost:27017/koach-dev    // Mongo database url
#DATABASE_URL=mongodb://mongodb:27017/koach-dev     // Mongo database url while using docker
DB_PATH=/home/ulap28/work/systango-frameworks       // path where database volumen mounted.

## Installation
```bash
git clone https://github.com/SystangoTechnologies/Koach.git

Features

Structure

├── bin
│   └── server.js            # Bootstrapping and entry point
├── cert
│   ├── server.cert          # SSL certificate
│   └── server.key           # SSL certificate key
├── config                   # Server configuration settings
│   ├── env                  # Environment specific config
│   │   ├── common.js
│   │   ├── development.js
│   │   ├── production.js
│   │   └── test.js
│   ├── index.js             # Config entrypoint
│   └── passport.js          # Passportjs config of strategies
├── src                      # Source code
│   ├── modules              # Module-specific controllers
│   │    ├── common          # Contains common modules
│   │    │   ├─── home              
│   │    │   └─ index.js
│   │    ├── v1              # Version 1 of APIs
│   │    │   ├─ Auth
│   │    │   ├─ User   
│   │    │   └─ index.js            
│   │    └─── v2             # Version 2 of APIs
│   │         ├─ Auth
│   │         ├─ User   
│   │         └─ index.js
│   ├── models               # Mongoose models
|   ├── requestModel
|   |    ├── v1
|   |    |  ├── auth.js
|   |    |  └── users.js
|   |    └── v2
|   |       ├── auth.js
|   |       └── users.js
|   ├── responseModel
|   |    ├── v1
|   |    |  ├── auth.js
|   |    |  └── users.js
|   |    └── v2
|   |       ├── auth.js
|   |       └── users.js
│   └── middleware           # Custom middleware
│       └── validators       # Validation middleware
└── test                     # Unit tests
└── pm2.config.js            # PM2 configuration file
└── Dockerfile               # Docker file
└── docker-compose.yml       # Docker Compose file

Usage

  • npm start Start server on development mode with Nodemon
  • npm run prod Start server on production mode with PM2
  • npm run docs Generate API documentation
  • npm test Run mocha tests

Running the server in Docker Container

Prerequisite For Docker Configuration : Docker and docker compose must be installed on the system.

Steps to run app in docker container :

  1. CD to project dir
  2. Create build using cmd: $ docker-compose build
  3. Start the server in daemon thread using cmd: $ docker-compose up -d
  4. Stop the server using cmd : $ docker-compose down

Documentation

API documentation is written inline and generated by apidoc.

Visit https://localhost:3000/docs/ to view docs

To view swagger API documentation

Visit https://localhost:3000/swagger to view Swagger UI.

Performance Comparison

The environment for the test cases are following-

  • Node Version: 8.9.4
  • Number of Users: 1500
  • Ramp-up Period: 300 seconds
  • Loop Count: 100

Average Throughput

Contributors

Arpit Khandelwal Anurag Vikram Singh Vikas Patidar Sparsh Pipley

License

MIT.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
omeryavuz/yemek_koala: Rails 3 Facebook Application Example Project Using Koala ...发布时间:2022-07-09
下一篇:
AqingCyan/Island-KoaServer: 发布时间:2022-07-09
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap