I'm developing a public e-commerce site in NodeJS and MongoDB, and I'm using forever instead of nginx or anything like that. (please let me know if I'm totally insane for doing this and why before I get too far along :)
As part of this site I need to calculate shipping, but I need to know that the numbers are spot on because I want to charge customers at checkout.
How could I set this up with Node.js?
I kind of have one solution, but I have no guarantee that it's accurate. Has anyone dealt with the UPS APIs using Node?
Thanks in advance for your help
Someone named Jesse D. Pate has developed a native UPS API. I have no idea if it's worthwhile, but the github repo is here, and it can be installed and toyed around with via
npm install ups_node
I think I've got it figured out ...now to start a Github project
This is a universal way to do it:
I modified the ./RatingPackage/PACKAGEXMLTools/Rate_Tool_SampleRequest.xml to include my information then I saved it as testRequest.xml then I posted it to https://wwwcie.ups.com/ups.app/xml/Rate (their test server) using the command
curl -X POST -d "`less testRequest.xml`" https://wwwcie.ups.com/ups.app/xml/Rate
and it returns an XML document that can then be converted to the (superior) json format and used in a web app.
I developed a node module with support for more functionality (and will continue improving) of the UPS API. With this module you can provide rating information, create a shipment, produce a label, void a shipment, track shipments, and perform address validation.
Check it out:
npm install shipping-ups
Read docs here: https://github.com/typefoo/node-shipping-ups
Related
I've created a webapp where most of the processing is done by the users browser using Javascript. For it's development I've used locally stored JSON docs but I need to be able store these in an Azure Cosmos DB.
I'm struggling to understand how to create an Azure function where I can do AJAX calls to the function, which is then passed on to the DB. I've been playing with node.js and express but how do you link DocumentDB module and expose that to another module that can provide AJAX requests?
I've tried looking through Microsofts examples but they are huge, pulling in loads of modules and trying to reverse engineer them and understand how they work is almost impossible for a newbie like me. Can any point in the right direction? Happy to learn and read up but I've not found anything on Google despite spending all day looking.
More research (and coffee) today. The way I've figured this out is follow this SkillShare course
Using the code function in Postman (set to JavaScript XHR) will give you the AJAX calls and following the link Marc gave in the comments to my question will allow you to swap the Mongoose package for the DocumentDB package. Then it's just a case of writing functions and a user interface around this.
I'm going to start by building a user interface page for the courses CRUD app as a prototype before looking to translate this to DocumentDB.
I am building a web application with a React frontend, served by a golang api layer. I don't use Javascript a ton, so I'm not super familiar with the Node build system. Is there a way to set up a script similar to npm run build, but which leaves debugging information intact so that I can effectively use the browser debugger?
This has been long requested from the CRA team - see issue #1070. The CRA team was a bit hesitant to implement it at first, but there is now over 150 +1 votes, so I'm hopeful it will get done (please vote). Also, that ticket contains multiple stop-gap solutions to the question.
Should Node.js be the basis of a website or be used only when certain functionality (eg. a chat room) is needed?
For example, in certain project, I'm using npm and have a node_modules folder and a package.json file in the main directory where all my code is.
However, the question I'm asking is whether or not this is good practice? Should Node.js only be used in, for example a chat-room/ folder? Or is it OK to use the same Node.js installation across an entire website, using when needed?
Many companies recently are having a hard job to detach their front end code from their server, hence, if you are starting a project from scratch, this is something you want to avoid.
Having low coupling applications will give you the flexibility to change your whole Front End stack without changing a single code in your API. Moreover, you will be able to use your API from different applications. They will now work independently.
The routing is how you define the URL, verb and opt parameters.
I hope that is what you have been struggling with.
I'm trying to implement a OAuth2 appcelerator connector for Studio to connect to a wordpress (WP has installed plugins REST API, OAuth2 server). And appcelerator download this module https://github.com/JiriChara/titanium-oauth2-client, but it is a version of 2012 which certainly has flaws. Unfortunately I could not make them work together.
I want to ask the community (Since it is the first time I am developing this type of connection between an app and a website in wordpress), if they have any solution please.
Thank you very much
I think that since the oAuth protocol hasn't changed, you should still be able to use that library you linked to. I see that it hasn't been updated in a while - and maybe that's because there is nothing to update.
If you encounter specific problems using the library you can clone the source and try to fix (maybe even revive the project and push back to GIT).
Basically, oAuth is a set of HTTP calls - so you can write it on your own. But since a lot of the job was already made in that module I would try to get it working and push whatever fixes I can so others searching for the same thing can enjoy it as well.
Take a look at this repo. It is an Appcelerator Titanium widget that was written to work with Azure oAuth2 but it would only take slight modifications to make it work with other oAuth2 systems. I was successful doing this for a recent project.
https://github.com/grantges/co.grantges.azure.adal
The first is that they can update the code (include to require) . I also try to take this module, but does not work .
regards
Is there a Javascript implementation of Git?
I'm wanting to use HTML5 to create a rich Javascript application and have the idea that I could use git to track changes to the data. So, I'm wondering if there is a javascript implementation of a git client, or maybe some way of controlling a git repository by making POST requests.
Check out: https://github.com/danlucraft/git.js
A pure js implementation of git in javascript.
This https://github.com/creationix/js-git is and will be the future!
It is backed by a kickstarter campaign and has a very sound software design.
Many of the client use-cases such as git clone have been implemented
According the answer to my question on the issue tracker [1]. The author also plans to implement parts of the server side stuff to allow you to build a server with it.
https://github.com/creationix/js-git/issues/33
You can use https://github.com/isomorphic-git/isomorphic-git
isomorphic-git is a pure JavaScript reimplementation of git that works in both Node.js and browser JavaScript environments. It can read and write to git repositories, fetch from and push to git remotes (such as GitHub), all without any native C++ module
isomorphic-git is a continuation of https://github.com/creationix/js-git
isomorphic-git would not have been possible without the pioneering work by
#creationix and #chrisdickinson. Git is a tricky binary mess, and without
their examples (and their modules!) I would not have been able to come even
close to finishing this. They are geniuses ahead of their time.
Related questions:
Run git push from javascript hosted in static site
How to implement Git in pure Javascript to create a GUI?
I guess it depends on what you need, but there's a few related projects out there.
The most "robust" implementation I can think of is this one by the 280North crew (of Cappuccino fame).
There's also some server-side JavaScript projects underway (e.g., http://github.com/ajaxorg/node-github), but that won't run entirely within a browser client.
Update (for anyone else who comes across this):
Please be sure to check out vanthome's answer. Tim Caswell's js-git project is well funded and undoubtedly the best answer here at this time.
I just recently wrote a Git client called Nougit. Maybe this resembles something you are looking for?
$ npm install nougit
https://github.com/gordonwritescode/nougit
This is a full GUI, but the module inside named "git.js" is an API I wrote specifically to do what you are describing. Yank out the file, and you can use express to handle the http routes.