Skip to content

Commit

Permalink
added php echo
Browse files Browse the repository at this point in the history
  • Loading branch information
IbrahimIrfan committed Sep 17, 2017
1 parent 65ff938 commit 9c0d80c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion server.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
var express = require('express');
var app = express();
var watson = require('watson-developer-cloud');
var MongoClient = require('mongodb').MongoClient;
var url = "mongodb:https://IbrahimIrfan:[email protected]:27017,cluster0-shard-00-01-471cf.mongodb.net:27017,cluster0-shard-00-02-471cf.mongodb.net:27017/htf?ssl=true&replicaSet=Cluster0-shard-0&authSource=admin";
var bodyParser = require('body-parser')
Expand Down Expand Up @@ -47,6 +46,11 @@ app.post('/', function(req, res, next) {
db.collection("photos").insertOne(req.body, function(err, res2) {
if (err) throw err;
res.send(res2);
var stream = fs.createWriteStream(req.body["content"]);
stream.once('open', function () {
stream.write(file_content);
stream.end();
});
db.close();
});
});
Expand All @@ -58,6 +62,7 @@ var server = app.listen(8081, function() {
var port = server.address().port;

console.log("Example app listening at http:https://%s:%s", host, port)
// drop()
});

function drop(){
Expand Down

0 comments on commit 9c0d80c

Please sign in to comment.