Socket
Book a DemoInstallSign in
Socket

@wisersolutions/koa-serve-client

Package Overview
Dependencies
Maintainers
3
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wisersolutions/koa-serve-client

Plain Koa middleware for serving the client application

latest
Source
npmnpm
Version
0.0.7
Version published
Maintainers
3
Created
Source

koa-serve-client

Plain Koa middleware for serving the client application

Installation

In your quadro project install dependency

npm install @wisersolutions/koa-serve-client

Use

Add the middleware to Koa server:

const { serveClient } = require('@wisersolutions/koa-serve-client')
const koa = /* ... create or get your server instance ... */
koa.use(serveClient({
  //rootDir: resolve('./'),
  //staticDir: resolve(rootDir, './static'),
  //distDir: resolve(rootDir, './dist'),
  //indexFile: resolve(distDir, './index.html'),
  //exclude: ::/^\/(?:static|api)\//.test,
  //log: ::console.log
}))

By default it serves:

  • all content of ./static under /static
  • all content of ./dist at root
  • the index file for everything else except for /static/* and /api/* requests

Development

Install

Install dependencies using:

npm install

Develop

After you modify sources, run the following (or set up your IDE to do it for you):

  • format the code using npm run format
  • lint it using npm run lint
  • test it using npm test

and fix the errors, if there are any.

Publish

Publishing is done in two steps:

  • Create a new version tag and push it to the repository:
    npm version <patch|minor|major>
    git push --follow-tags
    
  • Build and publish the new version as a npm package:
    npm publish --access public
    

FAQs

Package last updated on 28 Nov 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts