Using WebStrom can easily debug the Node applcation.

For example, we have an Node+Express application.

server.js:

/**
* Created by Answer1215 on 12/9/2014.
*/
'use strict'; var expres = require('express');
var app = expres(); app.get('/', function(request, response) {
response.send(200, "Hello world");
}); app.listen(3000);

All it does just send back an "Hello World" string.

What we want is to see how to use webstrom to debug this server.js and get "Hello World" string from the console.

It will show:

Then in the Tools bar, select RESTful Client:

Set the HTTP method, Host/port, and Path, then click run, you will get "Hello world".

Notice that, if you modify the server.js, you should rerun the debug to get the lastest modification.

For example: We add a people path.

/**
* Created by Answer1215 on 12/9/2014.
*/
'use strict'; var expres = require('express');
var app = expres(); app.get('/', function(request, response) {
response.send(200, "Hello world");
}); app.get('/people', function(request, response){ response.json(200, "People yled");
}); app.listen(3000);

After rerun the debug, In RESTful client, we get:

[MEAN+ Webstrom] First API -- 2.Debug Node.js RESTful application的更多相关文章

  1. Node.js RESTful API

    什么是REST架构? REST表示代表性状态传输.REST是一种基于Web标准的架构,并使用HTTP协议. 它都是围绕着资源,其中每一个组件是资源和一个资源是由一个共同的接口使用HTTP的标准方法获得 ...

  2. 使用 GitHub API 进行数据分析 (Node.js)

    使用 GitHub API 进行数据分析 (Node.js) Node.js 的访问 GitHub 的 API 库,通过 npm 或者 yarn 安装: yarn add github-api 官方示 ...

  3. [MEAN Stack] First API -- 1. with Node.js, Express and MongoDB

    Learn how to import data into your MongoDB and then use Express to serve a simple Node.js API. Impor ...

  4. 一个完整的Node.js RESTful API

    前言 这篇文章算是对Building APIs with Node.js这本书的一个总结.用Node.js写接口对我来说是很有用的,比如在项目初始阶段,可以快速的模拟网络请求.正因为它用js写的,跟i ...

  5. [Debug] Debug Node.js Application by using Chrome Dev tools

    For example you have a server.js file, and you want to debug some problems; What you can do is: node ...

  6. 49.Node.js RESTful API

    转自:http://www.runoob.com/nodejs/nodejs-express-framework.html 什么是 REST? REST即表述性状态传递(英文:Representati ...

  7. 使用 Node.js 搭建一个 API 网关

    原文地址:Building an API Gateway using Node.js 外部客户端访问微服务架构中的服务时,服务端会对认证和传输有一些常见的要求.API 网关提供共享层来处理服务协议之间 ...

  8. [Node.js] 08 - Web Server and REST API

    有了 [Node.js] 07 - Html and Http 作为基础,再继续下面的内容. Node.js 路由 Node.js GET/POST请求 Node.js Web 模块 Node.js ...

  9. 十个书写Node.js REST API的最佳实践(上)

    收录待用,修改转载已取得腾讯云授权 原文:10 Best Practices for Writing Node.js REST APIs 我们会通过本文介绍下书写Node.js REST API的最佳 ...

随机推荐

  1. Python面向对象3

    一.内部类 内部类就是在类的内部定义的类,主要目的是为了更好的抽象现实世界. 二.魔术方法(构造函数和析构函数) #!usr/bin/python #coding:utf8 class Milo(): ...

  2. Eclipse使用技巧总结

    Eclipse设置工作空间的字符编码: 打开eclipse开发界面,依次点击Window->Preferences->General->Workspace 修改Text file e ...

  3. Mysql报错:1172 - Result consisted of more than one row

    执行mysql函数时报错:1172 - Result consisted of more than one row 函数语句中select into语句中WHERE account = userNam ...

  4. SNMP 和 NetBios协议理解

      一.简单网络管理协议(SNMP,Simple Network Management Protocol)构成了互联网工程工作小组(IETF,Internet Engineering Task For ...

  5. SCAU 10690 分面包

    10690 分面包 时间限制:1000MS  内存限制:65535K 题型: 编程题   语言: 无限制 Description 在大一的时候,XCC还在stu union打酱油~~~~和十三还有奶子 ...

  6. css3 钟表

    <!doctype html> <html> <head> <meta charset="utf-8"> <title> ...

  7. STM32中的位带(bit-band)操作

    转:http://blog.csdn.net/gaojinshan/article/details/11479929 //位带操作,实现51类似的GPIO控制功能 //具体实现思想,参考<< ...

  8. 【LeetCode】 Subsets

    Given a set of distinct integers, S, return all possible subsets. Note: Elements in a subset must be ...

  9. CGI 是什么

    CGI是公共网关接口,是Java Servlet 的前身,Java Servlet  是运行在服务器端的小程序.

  10. IP地址转换成Long型数字的算法

    在应用程序开发中,涉及到IP地址的存储,大部分开发人员都将其存为String(或文本类型).能否将固定格式为m.n.x.y的IP地址转换成 Long型的数字呢?答案是肯定的.在数据库层面,可以直接将结 ...