简体   繁体   中英

Node module with client side javascript

Background: I'm developing a web application and need to communicate with an API that does not have JSONP/CORS support, my first though was to set up a server with php code and make ajax calls to it.

Now I found this node module which seems really easy to just use and has the functions I need. Problem is I have zero experience in using node.js, the only thing I know is that it is server-side javascript.

How do I (easiest way) use/communicate with a node module like this with my client (angular/html) application? I've been googling around but get more and more confused, I would really appreciate a dummy step-by-step description here.

there are various tutorials on web, some of them are:

https://scotch.io/tutorials/

http://learn.mean.io/

for creating simple web api, try with http://expressjs.com/

also you can check http://yeoman.io/ which give you instant start with there beautiful boilerplates, but first i would prefer you should setup a mean stack app.

I would suggest making a Node application with the module you mentioned. You can then communicate with the Node application through express. http://expressjs.com/

If you know Angular, you can use the $http provider to send http request (post, get, etc) to the url endpoints you made with express. Don't forget to set headers in your node application to allow for CORS from your Angular application.

Like AT said, scotch.io has some pretty good tutorials for this specifically.

Since you are new to node.js, The Node.js Framework ie Express.js Module. Since i am Using It for Last 6 months,i found very easy and simple.

The Express.js is Based on MVC Architecture,hence is Best Suited For Client-Server Application.

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