diff options
author | Peter Wu <peter@lekensteyn.nl> | 2015-04-28 12:27:20 +0200 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2015-04-28 12:27:20 +0200 |
commit | 5e8f53977c26fd0c1764a9183135b8a91c364a23 (patch) | |
tree | fa3505ec57d9b598f12e2a67a35bba1b90e7357f | |
parent | b6c6c7075c4745466faabe8e15d4d18f54551bbc (diff) | |
download | n-5e8f53977c26fd0c1764a9183135b8a91c364a23.tar.gz |
Initialize with Hello world
-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" + } +} |