-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
node no_hardware.js #79
Comments
same here update these examples |
Did not get you, I have updated all pulled complete repo. How to sort out this error |
The idea is when you use import statements in node js code you have now
required ES6 and to babel to be used to compile your code. you do not
mention this in you tutorial. And it is not setup correctly on github in
the package.json file either. Look at the comments there. Why not just try
to do the tutorial as Witten in a fresh folder and you will see as written
this tutorial will not work and could never have worked as written. If you
are not familiar with node or java script enough find someone who is and
fix it. I was thinking about using your products but there is a serious
lack of clear documentation.
On December 6, 2018 at 1:10:12 AM, Rahul Mehta ([email protected]) wrote:
Did not get you, I have updated all pulled complete repo. How to sort out
this error
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#79 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/APLYbAbFFqW7K9MWFetjOlLpIOE6x1Hkks5u2N7BgaJpZM4ZDK35>
.
|
Thanks for respondingI tried googling and installation of bable etc using npmBut still struggling
On Thursday, December 6, 2018, 9:19:18 AM GMT, Jeffrey Lytle <[email protected]> wrote:
The idea is when you use import statements in node js code you have now
required ES6 and to babel to be used to compile your code. you do not
mention this in you tutorial. And it is not setup correctly on github in
the package.json file either. Look at the comments there. Why not just try
to do the tutorial as Witten in a fresh folder and you will see as written
this tutorial will not work and could never have worked as written. If you
are not familiar with node or java script enough find someone who is and
fix it. I was thinking about using your products but there is a serious
lack of clear documentation.
On December 6, 2018 at 1:10:12 AM, Rahul Mehta ([email protected]) wrote:
Did not get you, I have updated all pulled complete repo. How to sort out
this error
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#79 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/APLYbAbFFqW7K9MWFetjOlLpIOE6x1Hkks5u2N7BgaJpZM4ZDK35>
.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I have already figured it out and rewrote the program taking out the es6
features. There is also another mistake as well in the tutorial it says to
name your function logTemperatureReading and in the code the function is
named ImpWrite, so it will never call the function for someone just
learning and unfamiliar with your error structure this is very confusing.
On December 6, 2018 at 1:54:41 AM, Rahul Mehta ([email protected])
wrote:
Thanks for respondingI tried googling and installation of bable etc using
npmBut still struggling
On Thursday, December 6, 2018, 9:19:18 AM GMT, Jeffrey Lytle <
[email protected]> wrote:
The idea is when you use import statements in node js code you have now
required ES6 and to babel to be used to compile your code. you do not
mention this in you tutorial. And it is not setup correctly on github in
the package.json file either. Look at the comments there. Why not just try
to do the tutorial as Witten in a fresh folder and you will see as written
this tutorial will not work and could never have worked as written. If you
are not familiar with node or java script enough find someone who is and
fix it. I was thinking about using your products but there is a serious
lack of clear documentation.
On December 6, 2018 at 1:10:12 AM, Rahul Mehta ([email protected]) wrote:
Did not get you, I have updated all pulled complete repo. How to sort out
this error
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#79 (comment)
,
or mute the thread
<
https://github.com/notifications/unsubscribe-auth/APLYbAbFFqW7K9MWFetjOlLpIOE6x1Hkks5u2N7BgaJpZM4ZDK35
.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#79 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/APLYbBF58qNL7oobmPYndYzjIU8bLdrAks5u2OlJgaJpZM4ZDK35>
.
|
// Set-up the Stitch client
*// here is the code besides running. **npm install*
*// also run. npm install *mongodb-stitch-server-sdk
// then everything should work as advertised
const {
Stitch,
AnonymousCredential,
} = require('mongodb-stitch-server-sdk');
// Send sample data while within this loop
function generateData(stitchClient) {
// Create a random temperature and humidity data point with
// temp ranging from -20 to 20 °C
const myData = {
"temp" : Math.floor(Math.random() * 20) - 20,
"humid" : Math.floor(Math.random() * 100)
};
// Print to the console
console.log(myData);
// Simulate write to MongoDB every 2 minutes
stitchClient.callFunction("logTemperatureReading", [myData] ).then(
setTimeout(() => generateData(stitchClient), 120000)
);
}
// Use the API Key to load data
const stitchClient = Stitch.initializeDefaultAppClient(“<your-app-id>");
stitchClient.auth.loginWithCredential(new AnonymousCredential())
.then(() => {
generateData(stitchClient);
});
On December 6, 2018 at 2:00:28 AM, Jeffrey John Lytle ([email protected])
wrote:
I have already figured it out and rewrote the program taking out the es6
features. There is also another mistake as well in the tutorial it says to
name your function logTemperatureReading and in the code the function is
named ImpWrite, so it will never call the function for someone just
learning and unfamiliar with your error structure this is very confusing.
On December 6, 2018 at 1:54:41 AM, Rahul Mehta ([email protected])
wrote:
Thanks for respondingI tried googling and installation of bable etc using
npmBut still struggling
On Thursday, December 6, 2018, 9:19:18 AM GMT, Jeffrey Lytle <
[email protected]> wrote:
The idea is when you use import statements in node js code you have now
required ES6 and to babel to be used to compile your code. you do not
mention this in you tutorial. And it is not setup correctly on github in
the package.json file either. Look at the comments there. Why not just try
to do the tutorial as Witten in a fresh folder and you will see as written
this tutorial will not work and could never have worked as written. If you
are not familiar with node or java script enough find someone who is and
fix it. I was thinking about using your products but there is a serious
lack of clear documentation.
On December 6, 2018 at 1:10:12 AM, Rahul Mehta ([email protected]) wrote:
Did not get you, I have updated all pulled complete repo. How to sort out
this error
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#79 (comment)
,
or mute the thread
<
https://github.com/notifications/unsubscribe-auth/APLYbAbFFqW7K9MWFetjOlLpIOE6x1Hkks5u2N7BgaJpZM4ZDK35
.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#79 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/APLYbBF58qNL7oobmPYndYzjIU8bLdrAks5u2OlJgaJpZM4ZDK35>
.
|
I am still getting error, please guide. |
Besides using this code as your new no_hardware.js also make sure the name of your function is
at the command line. // Set-up the Stitch client
// here is the code besides running. npm install
// also run. npm install mongodb-stitch-server-sdk
// then everything should work as advertised
const {
Stitch,
AnonymousCredential,
} = require('mongodb-stitch-server-sdk');
// Send sample data while within this loop
function generateData(stitchClient) {
// Create a random temperature and humidity data point with
// temp ranging from -20 to 20 °C
const myData = {
"temp" : Math.floor(Math.random() * 20) - 20,
"humid" : Math.floor(Math.random() * 100)
};
// Print to the console
console.log(myData);
// Simulate write to MongoDB every 2 minutes
stitchClient.callFunction("logTemperatureReading", [myData] ).then(
setTimeout(() => generateData(stitchClient), 120000)
);
}
// Use AnonymousCredential to load data
const stitchClient = Stitch.initializeDefaultAppClient('<your-app-id>');
stitchClient.auth.loginWithCredential(new AnonymousCredential())
.then(() => {
generateData(stitchClient);
}); |
I am getting the error as shown as below
Please guide, the command I ran was
node no_hardware.js
The text was updated successfully, but these errors were encountered: