Getting error Response with status: 404 Not Found for URL


I am facing an issue while running the angular and nodejs app which I am trying to integrate with Neo4j app. The issues are the errors that I get-

POST http://localhost:7474/viewNodesStart 404 (Not Found)


EXCEPTION: Response with status: 404 Not Found for URL: http://localhost:7474/viewNodesStart

Though this topic is repetitive in StackOverflow , I am still posting it because the following links suggestions didn't suit my issue.

<a href="https://stackoverflow.com/questions/42321466/angular2-404-not-found-for-url-http-localhost-webapi2-api-hero" rel="nofollow">Angular2 404 Not Found for URL: http://localhost/WebApi2/api/hero</a>

<a href="https://stackoverflow.com/questions/41989802/exception-response-with-status-404-not-found-for-url-angular2" rel="nofollow">EXCEPTION: Response with status: 404 Not Found for URL / Angular2</a>

<a href="https://github.com/johnpapa/angular-tour-of-heroes/issues/94" rel="nofollow">https://github.com/johnpapa/angular-tour-of-heroes/issues/94</a>

Please check my code


import { Component, OnInit } from '@angular/core'; import { Injectable } from '@angular/core'; import { ToasterService } from '../toaster.service'; import { FormGroup, FormControl, FormBuilder, Validators } from '@angular/forms'; import { Http, Response, Headers } from '@angular/http'; import { config } from '../config'; import { Subject } from 'rxjs'; import 'rxjs/add/operator/map'; import { map } from 'rxjs/operators'; import 'rxjs/Rx'; import { Observable } from 'rxjs'; // Statics import 'rxjs/add/observable/throw'; @Component({ selector: 'app-neo4j-primary', templateUrl: './neo4j-primary.component.html', styleUrls: ['./neo4j-primary.component.css'] }) export class Neo4jPrimaryComponent implements OnInit { constructor(private http: Http, private notify: ToasterService) { } ngOnInit() { this.viewNodesStart(); } emptyObj; info; // ------------------------------- Nodes Entire Data -------------- viewNodesStart() { console.log("INSIDE viewNodesStart()") // Nodes Value console.log("inside Nodes Value"); var data = localStorage.getItem('token'); console.log("data is=>",data); var url = config.url; var port = config.port; this.http.post("http://"+url+":"+port+"/viewNodesStart",this.emptyObj) .map(Response => Response.json()) .subscribe((res: Response) => { console.log("XXXXXXXXXXXX Response on /viewNodesStart", res); this.info = res; console.log('success', this.info.statusCode); if (this.info.statusCode == 200) { this.notify.Success("Data added successfully"); } else { this.notify.Error("Data is not inserted") } }); } }


var express = require('express'); var cors = require('cors'); var bodyParser = require('body-parser'); const neo4j = require('neo4j-driver').v1; var app = express(); var restify = require('restify'); var expressJwt = require('express-jwt'); var session = require('express-session'); var config = require('./config.json') app.use(restify.plugins.bodyParser()); app.use(bodyParser.urlencoded({ extended: false })); app.use(bodyParser.json()); app.use(bodyParser.json({ type: 'application/vnd.api+json' })) app.use(cors()); app.use(session({ secret: config.secret, resave: false, saveUninitialized: true })); //*****TM Server ******/ app.use('/viewNodesStart', require('./neo4jserver/tmserver')); app.get('/', function(req, res) { res.send('Welcome'); console.log("welcome in console"); }); // start server var server = app.listen(7473, function() { console.log('Server listening at http://' + server.address().address + ':' + server.address().port); });


// Require Neo4j var neo4j = require('neo4j-driver').v1; var path = require('path'); var logger = require('morgan'); var bodyParser = require('body-parser'); var express = require('express'); var router = express.Router(); var app = express(); // Create Driver const driver = new neo4j.driver("bolt://localhost:11001",neo4j.auth.basic("neo4j", "abc")); // Run Cypher query const cypher = 'MATCH (n) RETURN count(n) as count'; //View Engine app.set('views', path.join(__dirname, 'views')); app.use(logger('dev')); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: false })); app.use(express.static(path.join(__dirname, 'public'))); var session = driver.session(); app.post('/', function(req, res) { console.log("INSIDE NODE JS CONTROLLER OF viewNodesStart"); console.log("BODY IS ", req.body); var log = JSON.parse(req.body); console.log(log); session.run('MATCH (n) RETURN n LIMIT 25').then(function(result) { result.records.forEach(function(record) { console.log("record", record); console.log("result = ", result) console.log("record._fields[0].properties", record._fields[0].properties); res.status(200).send({ statusCode: '200', result: result }); }); }).catch(function(err) { console.log(err); }).then(res=>{ console.log("res.records.length", res.records.length); } ) res.send('It Works'); res.send(result); }); var allowCrossDomain = function(req, res, next) { res.header('Access-Control-Allow-Origin', '*'); res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE'); res.header('Access-Control-Allow-Headers', 'Content-Type'); if (req.method === "OPTIONS") res.send(200); else next(); } console.log('Server started on port 11005'); module.exports = router; module.exports = app;


I guess the problem is with the url you are passing to the http request. You are passing the path of the anuglar route and want to call the node api. Change the url there to the nodeapi url. Then it will work.


  • Angular2: json does not exist on type object
  • Share data between sibling components using non-singleton service
  • Angular - Override CSS of swimlane/ngx-datatable
  • Trouble passing and accessing data to stateless component in Angular
  • Java PriorityQueue Wait
  • Enabling or disabling validation upon context
  • Watch new file in gulp and browsersync issue
  • send() crashes my program
  • Titanium - Perform Action when user clicks on Android Notification
  • How to retrieve the Id of a single Firestore document?
  • Angular class directive on bootstrap ui modal
  • Uncaught Reference Input is not defined- @Input() not working in Angular 2
  • Push notifications don't work
  • How can i get the document title in Office 365 JavaScript API?
  • xcode 4.3.2 process hangs
  • Angular UI Router root named view template change from child view
  • Manage different base layouts in Angular2
  • Incorrect behaviour when selecting chips in Angular Material
  • Xamarin - is there a way to notify Xamarin.Forms from a native project?
  • Angular5 Service Worker update(SWUpdate) not detecting on firefox. Working on chrome
  • Deploying pre-encrypted configuration files to a production environment
  • Instanciate service on startup in Angular2
  • get passwords from chrome
  • Call a php script whenever an e-mail is received?
  • Center align outputs in ipython notebook
  • Adjust width of select element according to selected option's width
  • Modifying destination and filename of gulp-svg-sprite
  • jquery mobile loadPage not working
  • Akka Routing: Reply's send to router ends up as dead letters
  • Cannot Parse HTML Data Using Android / JSOUP
  • How to get icons for entities from eclipse?
  • Proper way to use connect-multiparty with express.js?
  • Load html files in TinyMce
  • CSS Applying specific rule for a specific monitor resolution with only CSS is posible?
  • Java static initializers and reflection
  • Change div Background jquery
  • unknown Exception android
  • JaxB to read class hierarchy
  • Observable and ngFor in Angular 2
  • Unable to use reactive element in my shiny app