[MEAN+ Webstrom] First API -- 2.Debug Node.js RESTful application
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的更多相关文章
- Node.js RESTful API
什么是REST架构? REST表示代表性状态传输.REST是一种基于Web标准的架构,并使用HTTP协议. 它都是围绕着资源,其中每一个组件是资源和一个资源是由一个共同的接口使用HTTP的标准方法获得 ...
- 使用 GitHub API 进行数据分析 (Node.js)
使用 GitHub API 进行数据分析 (Node.js) Node.js 的访问 GitHub 的 API 库,通过 npm 或者 yarn 安装: yarn add github-api 官方示 ...
- [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 ...
- 一个完整的Node.js RESTful API
前言 这篇文章算是对Building APIs with Node.js这本书的一个总结.用Node.js写接口对我来说是很有用的,比如在项目初始阶段,可以快速的模拟网络请求.正因为它用js写的,跟i ...
- [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 ...
- 49.Node.js RESTful API
转自:http://www.runoob.com/nodejs/nodejs-express-framework.html 什么是 REST? REST即表述性状态传递(英文:Representati ...
- 使用 Node.js 搭建一个 API 网关
原文地址:Building an API Gateway using Node.js 外部客户端访问微服务架构中的服务时,服务端会对认证和传输有一些常见的要求.API 网关提供共享层来处理服务协议之间 ...
- [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 ...
- 十个书写Node.js REST API的最佳实践(上)
收录待用,修改转载已取得腾讯云授权 原文:10 Best Practices for Writing Node.js REST APIs 我们会通过本文介绍下书写Node.js REST API的最佳 ...
随机推荐
- 求相同号码一天内的上网流量——mapreduce
上网数据 1363157985066 13726230503 00-FD-07-A4-72-B8:CMCC 120.196.100.82 i02.c.aliimg.com 24 27 2481 246 ...
- 设置sudo权限
由于CentOS安装之后,普通用户无sudo权限,故应该设置sudo权限. 此处假设当前用户为“cloudgis”. 1. 设置sudo权限,则设置如下: $ su root 输入root 密码 $ ...
- HDU5873:Football Games
题目链接: Football Games 分析: 先将分数排序,然后 设当前队编号为p,设个指针为p+1,然后p>1,每次p-=2,指针右移一位p==1,指针指向的队-=1p==0,从指针开始到 ...
- 调试Python代码的工具
pdb: 首先来说Python里内建的调试器,pdb.它利用一个简单的命令行界面,还有很多你在用调试器时用得上的功能.帮助系统能为你指出你能运行的命令,比如单步调试代码,操纵调用栈和设置断点. 一些它 ...
- UDP广域网,局域网通信-原理分析,穿透技术
一.UDP局域网通信. 这个比较简单,关于局域网中的2台或者更多的计算机之间的UDP通信,网络上一大把,直接复制粘贴就可以使用,原理也非常简单.所以,本文不做详细介绍. 二.UDP广域通信(包括路由器 ...
- Hadoop开发环境简介(转)
1.Hadoop开发环境简介 1.1 Hadoop集群简介 Java版本:jdk-6u31-linux-i586.bin Linux系统:CentOS6.0 Hadoop版本:hadoop-1.0.0 ...
- 如何用 redis 造一把分布式锁
基本概念 锁 wiki:In computer science, a lock or mutex (from mutual exclusion) is a synchronization mechan ...
- 三、 将DataTable 转换为List
1. 方法public static IList<T> ConvertTo<T>(DataTable table) { if (table == null) { return ...
- HD1013Digital Roots
Problem Description The digital root of a positive integer is found by summing the digits of the int ...
- 用keyword实现Editor.GetSelection的退出功能
有时候我们在使用 GetSelection 功能让用户选择实体时,可能会给用户提供一些 keyword 选项,要接收用户选择的 keyword 选项,需要用到 PromptSelectionOptio ...