Facebook
From Tinct Earthworm, 3 Years ago, written in JavaScript.
This paste is a reply to Untitled from Paltry Kangaroo - view diff
Embed
Download Paste or View Raw
Hits: 44
  1. var BigQuery = require('@google-cloud/bigquery');
  2. var projectId = 'projectId'; // kullandığın project ID
  3.  
  4. var bigquery = new BigQuery({
  5.   projectId: projectId,
  6. });
  7.  
  8. var datasetName = 'dataSetName';  // dataset adın
  9. var tableName = 'tabeName'; // tablo adın
  10.  
  11. exports.logData = (req,res) => {
  12.   var data = req.body;
  13.  
  14.   bigquery
  15.   .dataset(datasetName)
  16.   .table(tableName)
  17.   .insert(data)
  18.   .then(resp=>{
  19.         return res.status(200).json({
  20.                 resp
  21.         })
  22.   })
  23.   .catch(err => {
  24.         return res.status(400).json({
  25.                 err
  26.         })  
  27.   });
  28. };