diff options
-rw-r--r-- | app.js | 20 | ||||
-rw-r--r-- | package.json | 14 |
2 files changed, 34 insertions, 0 deletions
@@ -0,0 +1,20 @@ +#!/usr/bin/env node +'use strict'; +var express = require('express'), + app = express(); + +app.get('/', function(req, resp) { + resp.send('Hello!'); +}); + +var server = app.listen(3000, function() { + var host = server.address().address, + port = server.address().port; + + if (/:/.test(host)) { + // IPv6 literals + host = '[' + host + ']'; + } + + console.log('http://%s:%d', host, port); +}); diff --git a/package.json b/package.json new file mode 100644 index 0000000..db8606c --- /dev/null +++ b/package.json @@ -0,0 +1,14 @@ +{ + "name": "n", + "version": "0.0.1", + "description": "Playing with Express.js", + "main": "app.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "Peter Wu", + "license": "MIT", + "dependencies": { + "express": "^4.12.3" + } +} |