This repository was archived by the owner on Dec 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
66 lines (47 loc) · 1.9 KB
/
Copy pathserver.js
File metadata and controls
66 lines (47 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
var express = require('express');
var app = express();
var bodyParser = require('body-parser');
// var readline = require('readline');
var fs = require('fs');
// var rl = readline.createInterface({
// input: process.stdin,
// output: process.stdout
// });
// // Oauth
// var google = require('googleapis');
// var OAuth2 = google.auth.OAuth2;
// fs.readFile('client_secret_262744244453.json', 'utf8', function(err,file){
// if(err){
// throw err
// } else {
// var client_secret = JSON.parse(file);
// var oauth2Client = new OAuth2(client_secret.web.client_id, client_secret.web.client_secret,client_secret.web.redirect_uris);
// // generate a url that asks permissions for Googlesheets scopes
// var scopes = [
// 'https://www.googleapis.com/auth/spreadsheets'
// ];
// var url = oauth2Client.generateAuthUrl({
// access_type: 'online', // 'online' (default) or 'offline' (gets refresh_token)
// scope: scopes // If you only need one scope you can pass it as string
// });
// console.log('Visit the url: ', url);
// rl.question('Enter the code here:', function (code) {
// // request access token
// oauth2Client.getToken(code, function (err, tokens) {
// // set tokens to the client
// // TODO: tokens should be set by OAuth2 client.
// oauth2Client.setCredentials(tokens);
// console.log(tokens);
// console.log(oauth2Client);
// });
// });
// };
// });
app.set('port', 8040);
app.use(bodyParser.json({limit: "50mb"}));
app.use(bodyParser.urlencoded({ extended: true, limit: "50mb" })); // for parsing application/x-www-form-urlencoded
// app.use('/post', require('./routes/googlesheets').googlesheets );
app.use('/', express.static('../VRD_draft/'));
app.listen(app.get('port'), function(){
console.log("Node app is running at localhost:" + app.get('port'));
});