[TASK] Introduce basic files for nodejs.

This commit is contained in:
Jan Philipp Timme 2013-09-13 18:49:44 +02:00
parent 4fb7991b8c
commit 1c5ddd7e82
4 changed files with 65 additions and 0 deletions

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
node_modules
snakeoil/*.pem
snakeoil/*.csr
settings.json
!settings.json.template

2
.npmignore Normal file
View File

@ -0,0 +1,2 @@
.git*
*.md

31
app.js Normal file
View File

@ -0,0 +1,31 @@
var express = require("express");
var http = require("http");
var https = require("https");
var fs = require("fs");
var app = express();
app.use(function(req, res, next) {
console.log("%s %s", req.method, req.url);
next();
});
//deliver static files by default
app.use(express.static(__dirname + '/static'));
app.use("/ohai", function(req, res) {
res.send("ohai!");
});
app.use(function(req, res) {
res.status(404).send("Sorry, nothing here.");
});
//http.createServer(app).listen(3000);
var httpsOptions = {
"key": fs.readFileSync("snakeoil/privkey.pem"),
"cert": fs.readFileSync("snakeoil/cert.pem")
};
https.createServer(httpsOptions, app).listen(3000);

27
package.json Normal file
View File

@ -0,0 +1,27 @@
{
"name": "dashboard",
"version": "0.0.1",
"description": "iGoogle-like dashboard",
"keywords": [
"web",
"dashboard"
],
"repository": "git://github.com/JPT580/dashboard.git",
"author": "Jan Philipp Timme <jan.philipp@timme.it>",
"dependencies": {
"express": "*"
},
"devDependencies": {},
/*
"licenses": [{
"type": "MIT",
"url": "https://raw.github.com/senchalabs/connect/master/LICENSE"
}],
*/
"engines": {
"node": ">= 0.8.0"
},
"scripts": {
"start": "node app.js"
}
}