New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@reframe/koa

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@reframe/koa

Use Reframe with Koa.

latest
Source
npmnpm
Version
0.3.2
Version published
Maintainers
1
Created
Source

@reframe/koa

Use Reframe with Koa.

Usage

Add @reframe/koa to your reframe.config.js:

module.exports = {
  $plugins: [
    require('@reframe/react-kit'),
    require('@reframe/koa')
  ]
};

Then eject the server code:

$ reframe eject server

Example

Example of a reframe app with ejected Koa server code.

// /plugins/koa/example/server/start.js

const Koa = require('koa')
const Router = require('koa-router');
const config = require('@brillout/reconfig').getConfig({configFileName: 'reframe.config.js'});
const {symbolSuccess, colorEmphasis} = require('@brillout/cli-theme');
const KoaAdapter = require('@universal-adapter/koa');

module.exports = start()

async function start () {
  const server = new Koa();

  server.listen(3000);

  server.use(
    // We use https://github.com/brillout/universal-adapter to integrate Reframe with Koa
    new KoaAdapter([
      // Run `$ reframe eject server-rendering` to eject the server rendering code
      config.ServerRendering,
      // Run `$ reframe eject server-assets` to eject the static asset serving code
      config.StaticAssets,
    ])
  );

  const router = new Router();
  router.get('/hello-from-koa', (ctx, next) => {
      ctx.body = 'Hello from Koa';
  });
  server.use(router.routes());

  const env = colorEmphasis(process.env.NODE_ENV||'development');
  console.log(symbolSuccess+'Server running (for '+env+')');

  return server
}

FAQs

Package last updated on 21 Apr 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