AWS Timestream With Node.JS - javascript

I am currently working on a project that utilizes an amazon timestream database. I am attempting to pull the information from the database using node to populate a dashboard, but I have no clue how to link the database to the node script. I have the AWS certification set up but can not get the server to connect for a query.

AWS has an SDK for this. For Timestream, check out the following:
https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-timestream-write/index.html
https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-timestream-query/index.html
The required AWS credentials can be configured as described in https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/loading-node-credentials-environment.html.

Related

ReactJS client and ExpressJS backend application production problems

I am new in reactjs and nodejs.I made an application with react frontend and express backend. There are axios post and get requests for get data from mssql database via express.
When the project in production level, I write the IPv4 address and port for access dashboard from another device in local network. After build,when I use for example localhost:5000 for requests, I can see all datas which are come from database in the device which react project running but with this I cant see datas from android phone in local network.
What should I do? Isn't there any other way than writing a static IP address? This project can be run different machines.
I am sorry for my spelling mistakes.

How to connet to the mysql server in zeit-now

I use zeit-now to deploy my website.
But I can't connect to my MySQL server.
I'm sure my MySQL server is able to be connected on my machine.
Here is my repo.
Any solution?
In the FAQ it says
Now itself focuses on being the best platform for serverless hosting. This means that the workloads we handle are static or stateless.
Still, you're trying to connect to your database on localhost. Although running a database instance in a docker container might be an option for a staging system, it definitely is not for production systems, since you will lose the data when you restart/redeploy. And you don't seem to startup a docker container in your deployment.
You should use a cloud database provider instead:
Use Cloud Databases that offer secure (preferably HTTPS-based) gateways, for example: Azure CosmosDB, MongoDB, Atlas, Firebase, Google Cloud SQL

How can I set database authentication in Mongodb - Is SSH Pipes better for MongoDB?

I have installed MongoDB in my computer. I did't define any password and username for the installation. I can see everything with Robo 3T.
Now I want to protect my database.
I have tried to set authentication for the database. I followed https://docs.mongodb.com/manual/tutorial/enable-authentication/ . It did not work.
I still can reach mongodb with robo 3t and see all information.
I have also tried to start mongodb with --auth parameter. I have define a configuration file looks like
And for starting mongodb
mongod -f C:\mongodb\conf\mongodb.conf
Mongodb has been started but, it did not ask any pass. And I can save simple data with Postman without authentication.
What I want to do:
Protect my database against Robo 3t. :))
I dont want to save any data without auth.
Building Nodejs connection string that include pass like
mysql://root:password#localhost:port/dbName
Here is my Nodejs index.js code
this is my model.
PS: I am very new in Nodejs and Mongodb.
EDIT: inside conf file

Connection mysql credentials ElectronJs

I am currently using Mysql in my electron application, so I started to verify the .asar file when I compiled it, I could see that all the application code is shown, so I think the Mysql connection would be very vulnerable, there is some way to correct this?
Image:

Point mongoos.connect at localhost mongodb

I am studying the MEAN stack by using this tutorial. But the tutorial connects to a remote mongodb installation. I have MongoDB running in the CentOS7 localhost.
How do I alter the mongoose connect line in server.js from the tutorial link above to connect to a localhost database instead of a remote database?
Here is the current line from server.js that needs to be changed to point to the localhost mongodb:
mongoose.connect('mongodb://node:nodeuser#mongo.onmodulus.net:27017/uwO3mypu');
A specific mongodb database has not been created yet. Do I need to create that also?
I'm fairly new at Mongo to, but I know how to connect to a local db. Basically I had to do the following:
Download the latest version of mongodb from https://www.mongodb.com/download-center?jmp=nav#community (according to your settings)
Once installed, I've created a folder that will be containing my DB.
Use a command line instance to start mongo like this:
mongod --dbpath [YOUR_DB_PATH]
Created a DB use mydb
With that you should have already a mongodb db instance looking for connections on default port. So you can change that line for this:
mongoose.connect('mongodb://localhost:27017/mydb');
Again, this is really basic and it is creating a mongo DB connection with all default options. So this will keep you rolling, but you may need to dig a bit more for custom options.
Hope this helps

Categories

Resources