const google = require('googleapis').google;
const OAuth2 = google.auth.OAuth;
const http = require('http'),
express = require('express'),
graphql = require('express-graphql'),
app = express();
app.use('/graphql', graphql({
/* some setting */
}));
http.createServer(app).listen(3000);
{ perMessageDeflate: true }
server {
listen 80;
server_name example.com;
location / {
proxy_pass http://localhost:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World');
}).listen(8080);
scan(middleware_path, middleware);
function scan (dir, d) {
fs.readdirSync(dir).forEach(function(file) {
if (fs.statSync(dir + '/' + file).isDirectory()) {
d[file] = d[file] || {};
scan(dir + '/' + file, d[file]);
} else if (file.endsWith('.js') {
file = file.slice(0, -3);
try {
d[file] = require(middleware_path + file);
} catch (e) {
console.log(e);
}
}
});
}
{$where:"this.isDeleted == false"}
{isDeleted: false}
request.post({url:'http://service.com/upload', form: {key:'value'}}, function(err,httpResponse,body){ /* ... */ })