I'm totally new in Backend, I'm trying to get the data from form and push it to the JSON file. I've tried to find the solution, but in most situation examples or separated or with MongoDB, but for learning I would like to do it just with Angular and Node.
What I have:
In Front-end I have submit function with says:
"Failed to load resource: the server responded with a status of 405 (Method Not Allowed) http://127.0.0.1:8080/Form/json/data.json " . Of course.$scope.submit = function(person) { $http.post('json/data.json', $scope.data).then(function(){ $scope.msg = 'Saved'; }); };- Back-end. I'm new in Node as I've already said, that's why my server is something like this:
var http = require('http'); var express = require('express'); var server = express(); server.use(express.static(__dirname)); var PORT = 8080; server.listen(PORT, function() { console.log(PORT); })
As I understand, I need to do a Post request at first from Angular controller to my server and than from the server Post request to my Json file? Please can someone to explain steps how to do it and simple code would be great.