I am just trying to write a simple node.js app that will be able to write to a file via post and access that file with the express.static().
var express = require('express'),
fs = require('fs')
url = require('url');
var app = express();
app.configure(function(){
app.use('/public', express.static(__dirname + '/public'));
app.use(express.static(__dirname + '/public'));
app.use(express.bodyParser());
});
app.post('/receieve', function(request, respond) {
filePath = __dirname + '/public/data.txt';
fs.appendFile(filePath, request.body)
});
app.listen(1110);
I'm using postman chrome extension to test if my post is working correctly, but I'm receiving 'cannot POST /receive' when I try to send raw json. Any ideas of what the problem could be? Thank you!