I am learning three.js. I have created simple 3D models using hardcoded parameters. My next step is to load the values from a database that I created in MSSQL Server. The x, y and z parameters are stored in a table named dimensions. My question is can I connect three.js with REST API (developed in SpringBoot or Node.js) that API will fetch the data from my DB and pass it to my three.js project which will render the object at runtime.
You aren't really dependent on three.js for that. You can create your API in Spring or Node, then in your client code (three.js), you can use something like fetch or ajax to actually call that API. Once you get a response, you can simply call functions that set appropriate values.
Related
I want to include the output of the Neo4j application in my Angular Front-end application. (I shall use Nodejs also for backend if required)Is there such a provision ?
Can you please let me know how to include only the middle portion of graph-diagram out of the entire UI of Neo4j-
When you fetch data from Neo4j HTTP api (Not sure about bolt), you can actually fetch graph relationship data.
Once you get that data, it is just a matter of plugging that into any graph visualization libraries available to create your own.
Here is some information along with some examples of Neo4j Graph Visualization
Am trying to build a server on NodeJS, I want to create a n api the simply takes two points and uses a google api and creates a route, I got lost in web, any recommendation for tutorials is appreciated
What you need here is a Direction API or Direction Service, it can calculate directions (using a variety of methods of transportation) by using the DirectionsService object. This object communicates with the Google Maps API Directions Service which receives direction requests and returns an efficient path. You may either handle these directions results yourself or use the DirectionsRenderer object to render these results.
The Directions service can return multi-part directions using a series of waypoints. Directions are displayed as a polyline drawing the route on a map.
Here are the sample jsfiddle for it.
http://jsfiddle.net/gHK7s/2/ and http://jsfiddle.net/user2314737/u9no8te4/
Now, to connect it with the Node.js that you want, you can check these SO questions on how to do that.
Using Node.js to connect to a REST API
Cannot connect to Google Directions API with Node.js server
For more information, check this Node.js Client for Google Maps Services
As the title suggest. I'm trying to figure out where I should cache data in my node.js application.
I'm using a express.js and controllers to handle the routes in the application. The controller for a particular route will get data via the model layer using REST API and then it uses handlebars for the view rendering on the server.
For this particular route, I'm displaying a menu and the data I have got for this has been done in the model and a remote REST call.
When the user select different items in the menu, I do not want to make a new REST call to get the same data for the menu again, I just need to get the data for this menu once since it will never change.
I need to find out a way to cache it, but do not know where I should implement it?
Best Regards
You could just cache the response from the REST API or DB lookup using a memory-store like Redis or Memcached, both have good modules available on npm - (Redis, memcached).
You would need to attempt to fetch the data from the memory-store (in your controller), if no matching data was found, you would make the request to the API or database to get the data, and then store it in your chosen memory-store so future requests will hit the cache.
note: There are also some pure JavaScript caches available such as memory-cache or lru-cache if you don't want to add an additional application.
I am attempting to run node.js commands within my three.js project. Something as simple as declaring SQLite3 and initializing my database doesn't seem to be working. Ultimately I want to run UPDATE, INSERT, DELETE commands throughout game play as the user picks up items. Since node.js and three.js are both JavaScript packages, I assumed they would fit well together. There doesn't seem to be much information about this, so what I want to know is it possible to combine the two or am I wasting my time?
var sqlite3 = require('sqlite3').verbose();
var fs = require('fs');
var db = new sqlite3.Database('shopDB.db');
As discussed, you can't use node.js in the browser. If you want your browser app to talk to a database, you can expose a REST API around your database. This means exposing some HTTP endpoints to access your data.
For example, you might POST some JSON object describing some data from your browser-based app to http://someurl/some_path and your web server would be listening for a POST to the /some_path url, at which point it would read the POST data and insert a new entry into your database.
You could use jQuery's ajax() function to make requests to the API.
This blog post runs through an example REST API built around a sqlite database.
In my Angular app, I want to display a table which contains the following
a) URL
b) Social share counts divided by different social networks
Using Sails.js, I already have the api created for the URL when the results show up, I can display the URL now I'm confused how to get the appropriate social counts showing right besides
Here's the API I'm using: https://docs.sharedcount.com/
by itself, I can see the JSON it produces
But here are my questions:
Should I create a new api (model/controller) for social count data or include it in my model where I have the 'url' action defined?
If I create a new api or include the social_counts as an action in the current, what would my JSON query look like? to retrieve the URL's, I'm using default API blueprint that Sails provides, so:
http://www.example.com/url/find?where={"title":{"contains":"mark"}}
Struggling a bit in terms of the thought process, would be great to get input on this
It depends on your app. is your app will store that data or just consume it? If it need to store, of course you need the API. In purpose for modification or aggregating the data for example.
No, you can't do that. That shortcut method only works if you have the data in your database and let the Sails Waterline ORM and Blueprint API served it.
Perhaps, if you only need to consume the data from that Sharedcount API, you didn't need to use Sails as a backend, in this context. Just use Angular as a client of that API. Except if you need to modify the data first and store it in your own database, so Sails will helps with it's Waterline ORM and Blueprint API.