A simple boilerplate to create REST apps with
Boilerplate is packed with koa-router@next in order to have a routing system.
Install development dependencies
npm i
Create a route
router.get('/:id', async (ctx) => {
ctx.body = await database.get(ctx.params.id);
// Feel the awesomeness
});
Run development
npm run development
Build
npm run build
Run the built version
node bin/server.bundle.js
// or
npm run run
Distribute and run the built file
npm i --production // to avoid dev dependencies
npm run run
### Exceptions
This boilerplate contains a simple HTTP exception system in order to demonstrate how to deal with exceptions in koa. See exceptions.js.
babel-node is not recommended for production. While node doesn't support natively async/await, we need to transpile the code with babel. Webpack is not necessary in this boilerplate but having the server built in a single file is pretty awesome though.
MIT
koa-webpack-middleware webpack-dev-middleware for koa2 with HMR(hot module replacement) supports. Install $ npm i koa-webpack-middleware -D Depends This middleware designd for koa2 ecosystem, make sur
webpack-babel-env-deps Find dependencies to transpile with Babel. �� Read the docs! A webpack helper to find dependencies of your project that require transpilation with Babel (and @babel/preset-env)b
babel-plugin-webpack-alias This Babel 6 plugin allows you to use webpack aliases and most of webpack resolve features in Babel. This plugin is simply going to take the aliases defined in your webpack
Tree-shaking example with Babel and Webpack This repository shows how to configure Babel and Webpack to enable tree-shaking.It will eliminate dead code if they have ES2015 module format. The source co
DEPREACTED due to lack of support/bug fixes/ new features, project abandoned, please migrate on https://github.com/webpack-contrib/terser-webpack-plugin Babel Minify Webpack Plugin A Webpack Plugin fo
webpack-babel-multi-target-plugin This project, inspired by Phil Walton's articleDeploying es2015 Code in Production Today,adds tooling to simplify the additional configuration with aWebpack plugin, B