简体   繁体   中英

Implement Restful api in node.js

I'm new to node.js and my question is quite a dumb one. I have created my restful api that does something but the problem is i have to call server.js file in the cmd. I want to create file called client.js that request the service from server.js and server.js will perform the job and return the result to client.js which will be shown to user.

You need to communicate via JSON data. When client accesses some url in server application, server application should provide data in JSON format.

Example - Server provides a list of people who have registered to your site. Than code your server in such a way that when client accesses www.example.com/accounts/users (where www.example.com is where your server is running), server should return a JSON response which client can than use to display.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM