Serving #react and Koa together
▻https://hackernoon.com/serving-react-and-koa-together-720ba6668298?source=rss----3a8144eabfe3--
Reactjs and #koajs are two great frameworks of #javascript. I wonder how to serve React and Koa projects in the same server and same port! Finally, I’ve reached a solution and today I’ll discuss it.In this article, we’ll create an API using koa and a React project (frontend) which will consume the API. The idea is very simple, React will fetch some book names from the backend (koa) and render them.Backend (Koa) projectKoa uses async functions, this gives an advantage over callback functions. By default, Koa does not come with any middlewares. That makes Koa very minimal and elegant.At first, we need to install node (koa requires node v7.6.0 or higher). Then install koa using : npm i koaCreate a project directory named “book” and run npm init -y.As koa doesn’t come with any middlewares and we need (...)