WIQL and other languages - javascript

Is WIQL specific to the TFS SDK or can it be used in other languages?
For example if I have built a client using TFS SDK that gets info about projects on the tfs, is it possible to somehow reuse the WIQL if I want to build a javascript client that does the same thing? Or is WIQL only used internally by the tfs sdk to create the proper soap request?

Your WIQL is processed on the TFS App Tier so, yes, you could conceivably write a Javascript client that sent WIQL queries to the server (in the context of a properly formed SOAP call). I wouldn't recommend it, however. The SOAP API for work item tracking isn't conducive to that approach.

Related

Can I create web api using express.js and not have node.js installed?

I am currently in the process of creating a portfolio website for myself but due to hosting restrictions, I cannot make use of Node.js.
I know Angular can run on any web server, but is it possible to make use of Express.js to create web api's with relying on Node.js to run these web api's using Express.js?
If not, is there an alternative solution to create web api's that I can call using Angular and later for my mobile version of my website?
Please note that my shared hosting runs using cPanel.
As per definition Express.js, or simply Express, is a web application framework for Node.js so you can't do that. Alternatives would be to use a different backend language.
That also depends if your server supports them, for example, you can go with .NET CORE
You cannot use Express without NodeJS by definition so you have to deploy your backend somewhere else in you want to use it.
I suggest giving a look Firebase: you could write your backend using http cloud functions in express without paying anything until a reasonable amount of traffic (after that, is pretty cheap). You could also get rid of cPanel and deploy your frontend there via Firebase hosting.
Maybe you can try to build at first a web application with express. Of course you can create a web app without express if you need it. With express and Node.js I created a MySQL REST API. With HTML and Ajax you can fetch the Data from the API. So you can create two applications. One application where you need to run Node.js because it`s much easier to create a REST API with express. The second one is fully without Node.js.
Maybe there are better solutions, but inside each Web Application you can than but you can then access this API in any web application using jQuery. It doesn't matter if it is written with PHP, ASP.Net Core, Java EE / EE4J. You can also access this API in Ruby, Angular, React, Vue etc. using an AJAX request.
In some scenarios you can't start Node.js as a server because an application is already running on apache2 or nginx. There this would be a workaround to use something like this. For example, one could also integrate applications with HTML+JS in a CMS system that accesses other database tables and thus extend such a system without an iframe.
So can be helpful for few scenarios. Now just doesn't get around the actual goal of doing without Node.js completely or even express. But why are there REST APIs? So that you can query the data and incorporate it somewhere else. Otherwise you would have to build a REST API with another technology. Especially in the example of accessing MySQL with JavaScript, this would not be quickly feasible.
If you are looking for a similar solution to separate the web app and the REST API, but you don't need Node.js, then you should really build a REST API with .Net Core or with another technology, depending on what is possible and installed on your server. It could be Java or PHP behind it or Ruby.
The API that provides the REST access does not have to be written in JavaScript. You only need to be able to access it with JavaScript. So you can use many different approaches to access JSON data. I hope that in the short time with my bad English I have explained the basic idea, how to proceed stylistically and where advantages exist in REST interfaces.
With this, it should be self-explanatory that you don't have to use NodeJS and Express, but with JavaScript it's a pleasant solution. Only you have to ask yourself if a JavaScript application has to provide this interface at all or if in the end only a JavaScript application has to access this interface. Very big difference.
For backend rest api you can use golang with gorilla framework. Golang simple keyword and easy to learn.best important point is performance. If your server support golang you can use golang for backend..
ExpressJS is NodeJS framework so it's impossible to create an API without NodeJS.
Angular is front-end framework so you can host it on web hosting server.
If you need to create back-end APIs, you can use other clouding host servers that support NodeJS.
It's fairly simple to build this with just the net/http package. Set up a router that handles various commands and deal with the response accordingly.

Connecting Server and Client with Javascript and C#

I need to create a web page that gets data from an SQL database, and can run certain executables (that have already been written from previous projects).The code to retrieve data from SQL was written in C#, as it was used previously with ASP.NET. Is it possible to reuse all of this code the way it is with my current application (using Angular)?
How to set up the server side? I know I probably have to create a web server, and then use "get" and "post" requests from the client side, am I on the right track. Can JavaScript client side communicate with a C#-written server side?
Unequivocally yes, you can have a JavaScript frontend communicate with a C# backend. There are two primary MS provided technologies that can be used:
ASP.NET WebAPI
SignalR
And lots of 3rd party ones (like Nancy).
WebAPI is a simple HTTP server typically used to build RESTful backends. Given your description its probably what you want to use.
SignalR is a protocol for "push" applications (though it can be used for server invocations). If you don't need to call client-side code its a bit overkill.
On the client side, if using WebAPI or similar on the backend, you just do HTTP requests as you would against any standard API. For AngularJS that's done with the $http service, for Angular (2+) that's Http and for 4+ HttpClient.

Can I Use Tumblr.js Without Node.js?

Reading the official documentation for Tumblr.js, it seems to require Node.js. I'd like to trigger a dialog box and let my app access the user blog. Can I make calls with vanilla JavaScript? I'd appreciate your help. I've been looking around the web and there is little information. Thanks.
HTML
<button onclick="loginTumblr();"> Connect Tumblr </button>
JS
function loginTumblr(){
//get user info + token
}
The answer is "probably," but it certainly won't be secure. Accessing an API from from the client side is risky because you'll have to expose your app's private credentials to the end user.
What you said regarding needing node is not necessarily correct; you could use any server side scripting (e.g., PHP) to safety call the api.
In all cases, make sure you are not exposing your keys or endpoints where other people could use your keys to access your personal account.
If you learn OAuth and CORS, you might be able to write an axios or fetch client. Node's "request" module is not easy to reverse engineer into client-side JS code. The browser versions I've seen don't support the OAuth addon it uses.
If you deploy to now.sh or a VPS, or write an Electron desktop client, you could use the node, golang, or python clients in the backend to proxy tumblr requests.
If you deploy to netlify, you could use the node or golang netlify functions to proxy tumblr requests.
If you deploy to any VPS environment or use serverless/lambda/cloudfunctions, you could proxy tumblr requests in most of the available cloud libraries.
I suspect you could compile the golang or c client to webassembly and expose their functions to JavaScript, but I don't recommend trying this.

JS to invoke a java method which inturn calls a Database

I need some help on solving the following:Write a JS to invoke a Java method which in turn calls a database. Host the application on tomcat. Use mysql as the database.
I wrote down a sample code in java and accessed a sample database from MySql, now- How can I access this from a JS.
My assumption here is that you are talking about client side java script and not server side java script. You are trying to implement a standard client-server use case. Here your java script code is client and your java code is server. Since your client side code will be running inside a browser most likely so your best best will be to expose your java method invokable over http protocol. For this you will need to host your Java application as a web-application using servers like Tomcat, JBoss etc. You can search about how to implement this on Google.
You can begin with following links:
http://helloworldprograms.blogspot.com/2010/08/servlet-hello-world.html
http://crunchify.com/create-and-deploy-simple-web-service-and-web-service-client-in-eclipse/

CQRS, Commands, Javascript

I have an architecture where a task-based UI passes commands to a service layer. Now, my intention is to implement the UI in javascript, using KendoUI and the service layer, domain layer etc. in .NET. I'm also looking at future mobile implementations of the client that may use say Java rather than Javascript.
If I define the commands in .NET, I'd like to know how to use them from my Javascript client so the client can communicate the commands appropriately to service layer. Do I have to use something like Apache Thrift for this i.e. to define the commands at both the client and service layer?
Since you use .NET have a look at this blog post I wrote, it uses t4 templates to render javascript objects of the C# Command/Query classes. The benefit from this is contract safty and code completion
http://andersmalmgren.com/2014/02/05/typed-javascript-contracts-using-t4-templates/
Typically, a service layer implemented with .NET cab be exposed as an HTTP API with which JavaScript communicates. The HTTP API implementation can be regarded as an adapter in a hexagonal architecture which relays all requests to application services, which in turn invoke commands on your domain model.
You may use Thift as an interface definition language to declare the messages that flow between client and server. Given, that the client is JavaScript based, you'd want to the JSON protocol which Thrift has support for.

Categories

Resources