Created
September 1, 2016 03:16
-
-
Save xubo-bj/850f914cc0aa2405b16dd91e8a251f54 to your computer and use it in GitHub Desktop.
findAjax
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title> | |
| <%= title %> | |
| </title> | |
| <link rel='stylesheet' href='/stylesheets/style.css' /> | |
| </head> | |
| <body> | |
| <h1><%= title %></h1> | |
| <p>Welcome to | |
| <%= title %> | |
| </p> | |
| <button>click</button> | |
| <script> | |
| var btn = document.querySelector('button'), | |
| var url = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=AbeR1WOW3cRfDDrNytORuESZ6gp9MAJFt6-WKeZz3WbI70GDf_Tx_rXAR-UULcOn2mH8WXLqDtRmmuXSlwo4hYWiC5BWQNe8GTu1xC0_Zyt7PONWBuHJoWaJknt1qc1lQGHfACADTU " | |
| var o = { | |
| "touser": "oGHAIwfSjOqfDMDMq4zgFGAIXfGs", | |
| "msgtype": "text", | |
| "text": { | |
| "content": "Hello World boy" | |
| } | |
| } | |
| btn.onclick = function(e) { | |
| var xhr = new XMLHttpRequest(); | |
| xhr.open('post', url, true) | |
| xhr.onload | |
| } | |
| </script> | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "bae-nodejs", | |
| "version": "1.0.0", | |
| "author": "bae", | |
| "description": "The first bae nodejs app!", | |
| "scripts": { | |
| "start": "node server.js" | |
| }, | |
| "dependencies": { | |
| "co": "^4.6.0", | |
| "debug": "^2.2.0", | |
| "ejs": "^2.5.1", | |
| "jade": "~1.11.0", | |
| "koa": "^1.1.2", | |
| "koa-bodyparser": "^2.0.1", | |
| "koa-json": "^1.1.1", | |
| "koa-logger": "^1.3.0", | |
| "koa-onerror": "^1.2.1", | |
| "koa-router": "^5.3.0", | |
| "koa-static": "^1.5.2", | |
| "koa-views": "^3.1.0" | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env node | |
| /** | |
| * Module dependencies. | |
| */ | |
| var app = require('./app'); | |
| var debug = require('debug')('demo:server'); | |
| var http = require('http'); | |
| /** | |
| * Get port from environment and store in Express. | |
| */ | |
| var port = normalizePort(process.env.PORT || '18080'); | |
| // app.set('port', port); | |
| /** | |
| * Create HTTP server. | |
| */ | |
| var server = http.createServer(app.callback()); | |
| /** | |
| * Listen on provided port, on all network interfaces. | |
| */ | |
| server.listen(port); | |
| server.on('error', onError); | |
| server.on('listening', onListening); | |
| /** | |
| * Normalize a port into a number, string, or false. | |
| */ | |
| function normalizePort(val) { | |
| var port = parseInt(val, 10); | |
| if (isNaN(port)) { | |
| // named pipe | |
| return val; | |
| } | |
| if (port >= 0) { | |
| // port number | |
| return port; | |
| } | |
| return false; | |
| } | |
| /** | |
| * Event listener for HTTP server "error" event. | |
| */ | |
| function onError(error) { | |
| if (error.syscall !== 'listen') { | |
| throw error; | |
| } | |
| var bind = typeof port === 'string' | |
| ? 'Pipe ' + port | |
| : 'Port ' + port; | |
| // handle specific listen errors with friendly messages | |
| switch (error.code) { | |
| case 'EACCES': | |
| console.error(bind + ' requires elevated privileges'); | |
| process.exit(1); | |
| break; | |
| case 'EADDRINUSE': | |
| console.error(bind + ' is already in use'); | |
| process.exit(1); | |
| break; | |
| default: | |
| throw error; | |
| } | |
| } | |
| /** | |
| * Event listener for HTTP server "listening" event. | |
| */ | |
| function onListening() { | |
| var addr = server.address(); | |
| var bind = typeof addr === 'string' | |
| ? 'pipe ' + addr | |
| : 'port ' + addr.port; | |
| debug('Listening on ' + bind); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment