Since the official server has integrated more than a dozen projects, my supervisor told me that this project may require the front-end to build its own server, and the back-end is responsible for the interface. So I thought of using nodejs as the server, but I would only start the nodejs service. As for how to use nodejs to cooperate with the backend interface, I have never tried it. I would like to ask you for advice!
我想大声告诉你2017-05-16 13:36:02
I just made one like this. . I didn’t know anything about node at the time
I used express. Creating a service is very simple. After init, you just need to change it slightly according to your business. It’s nothing more than router->controller->views, and the page is written in the router. For routing and controller, just go to the original backend through node to adjust the interface, and then render the data into views. To adjust the interface, I use node-rest-client. There are many similar ones. Just pick the one that suits your eyes. .
I divide it into interface calls in the controller and interface calls in the front-end page. You can encapsulate them yourself
習慣沉默2017-05-16 13:36:02
A good way to learn is to go to github and look for existing similar projects, see how others do it, and then follow suit.
淡淡烟草味2017-05-16 13:36:02
You can take a look at https://github.com/cristismf/...
02-db-demo should be helpful to you
PHP中文网2017-05-16 13:36:02
First of all, you need to know what database you want to use, and then learn to operate the database corresponding to nodejs. The backend interface will be gradually solved, and the front end will not be a problem for you