-
Notifications
You must be signed in to change notification settings - Fork 10
Howto
edoroshenko edited this page Mar 14, 2014
·
6 revisions
See https://github.com/pasaran/descript/pull/29
npm install node-inspector
# Run descript with cpus set to 2.
# This will start only one worker process.
descript --cpus 2 -p 2000
>> master 15970
>> forked 16101
# Connect debugger:
kill -USR1 16101
>> Hit SIGUSR1 - starting debugger agent.
>> debugger listening on port 5858
# Start node-inspector:
node_modules/.bin/node-inspector &
>> visit http://0.0.0.0:8080/debug?port=5858 to start debugging
# Go to this url using some webkit based browser:
# http://your-server:8080/debug?port=5858
# You will see standart web-inspector debugger.
https://github.com/dannycoates/node-inspector
Use {config.<name>}
:
http('http://{config.host}/action')
Use ?
at the end of the url (or &
if some parameters are predefined). All params from current URL will be passed to http block request.
http('http://{config.host}/action?')
http('http://{config.host}/action?ver=2&')
Parameters are passed without index suffixes:
/models/?_model.0=entity&id.0=7&login.0=che
will be
http://{config.host}/action?id=7&login=che
Use context.response
object:
{
data: http('http://{config.host}/action?', {
after: function(context, result) {
context.state.redirect_url = '...'; // generate redirect URL here.
}
}) +1, // Ensure this block to be executed before redirect.
more: function(context) {
context.response.setRedirect(context.state.redirect_url); // Redirect now.
}
}
???
we cannot redirect from the after
handler, only from func
block.
There is no special autotesting environment in descript yet. There is a number of pages, that can be run the following way:
- Create a page
.jsx
file in foldertests/pages
- Start the descript server by calling
./descript -c test/config.js
in the project root - Call a page by requesting
127.0.0.1:2000/{page file name}
via browser or curl utility, and check the result visually.