/fbi-project-mod

Node service or application template base on Koa 2.

Primary LanguageJavaScriptMIT LicenseMIT

fbi-project-mod

Node service or application template base on Koa 2.

This is a fbi project template. If you haven't installed fbi yet, use the following command to install.

$ npm i -g fbi or yarn global add fbi

Requirements

  • fbi v3.0+
  • node v7.6+

Features

  • ESLint
  • ES modules
  • Environment data config
  • Local development server using nodemon
  • Debug in VSCode

Usage

  1. Add template

    $ fbi add https://github.com/fbi-templates/fbi-project-mod.git
  2. Create a project

    $ cd path/to/empty-folder
    $ fbi init -o mod
    
    # or
    $ fbi init -o mod my-app
  3. Show available tasks

    $ fbi ls
  4. Run a task

    $ fbi s   # Start dev server
    $ fbi b   # Build the project for the specified environment
  5. Debug in VSCode

    # 1. Start dev server
    $ fbi s
    
    # 2. Attach existing process:
    Press `F5` in VSCode (support breakpoints in `src`)
  • Update template

    $ fbi up mod
  • Update project

    $ cd path/to/my-app
    $ fbi use vx.x.x  # use `fbi ls store` to check versions
  • Update options

    $ cd path/to/my-app
    $ fbi init -o

Test

$ curl -i http://localhost:3000/api/demo

Run the project in a production environment

$ npm start

Tasks

serve

  • Description: Compile and start development server.
  • Params:
    • d {Boolean} 'watch only' mode.
  • Alias: s
  • Examples:
    • fbi s
    • fbi s -d

build

  • Description: Build the project for the specified environment.
  • Params:
    • p/prod {Boolean} (default) Production environment.
    • t/test {Boolean} Test environment.
  • Alias: b
  • Examples:
    • fbi b -t
    • fbi b -p

Need file packaging?

check out fbi-task-pack

More

License

MIT