davezuko/react-redux-starter-kit create nodejs api endpoints. How to?

半腔热情 提交于 2020-01-07 00:04:31

问题


I just started to explore a bit this reactjs-redux boilerplate from davezuko which structure is fractal and I search a way to implement api endpoints to fetch data from mongodb.

What are the approaches? The way to go is to create a new route and somehow interact with Koa server?


回答1:


Reading over the boilerplate docs, it looks like the author included the Koa server only to load the hot module middleware.

If you want to create your own API endpoints for mongodb, you might want to create your own to separate concerns.

From the docs:

Server

This starter kit comes packaged with an Koa server. It's important to note that the sole purpose of this server is to provide webpack-dev-middleware and webpack-hot-middleware for hot module replacement. Using a custom Koa app in place of webpack-dev-server makes it easier to extend the starter kit to include functionality such as API's, universal rendering, and more -- all without bloating the base boilerplate.



来源:https://stackoverflow.com/questions/37194292/davezuko-react-redux-starter-kit-create-nodejs-api-endpoints-how-to

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!