小编rup*_*ram的帖子

开发nodeJS Web应用程序是否需要express.js框架

我正在尝试使用 HTML、NodeJS 和 Postgres 开发简单的 Web 应用程序。是否可以在不使用 ExpressJS 的情况下开发 Web 应用程序?请让我知道如何使用 NodeJs、Javascript 和 Postgres 而不使用 ExpressJS 框架来执行基本的 CURD 操作。提前致谢。

javascript postgresql node.js express angular

5
推荐指数
1
解决办法
2360
查看次数

无法在'XMLHttpRequest'上执行'open':无效的URL

我得到了运行时错误:

无法在'XMLHttpRequest'上执行'open':无效的URL错误:无法在'XMLHttpRequest'上执行'open':无效的URL位于http:// localhost:8100/build/polyfills.js:3:2793, 位于XMLHttpRequest.open (eval at s(http:// localhost:8100/build/polyfills.js:2:29793),:3:31)

import { Injectable } from '@angular/core';
import { Http, Headers } from '@angular/http';
import 'rxjs/add/operator/map';

@Injectable()
export class Reviews {


  data: any;

  constructor(public http: Http) {
    this.data = null;
  }

  getReviews(){

    if (this.data) {
      return Promise.resolve(this.data);
    }

    return new Promise(resolve => {

      this.http.get('http://localhost:app/api/reviews')
        .map(res => res.json())
        .subscribe(data => {
          this.data = data;
          resolve(this.data);
        });
    });

  }

  createReview(review){

    let headers = new Headers();
    headers.append('Content-Type', 'application/json');

    this.http.post('http://localhost:app/api/reviews', JSON.stringify(review), {headers: …
Run Code Online (Sandbox Code Playgroud)

mean ionic2 angular

3
推荐指数
1
解决办法
2万
查看次数

标签 统计

angular ×2

express ×1

ionic2 ×1

javascript ×1

mean ×1

node.js ×1

postgresql ×1