Skip to content

Commit

Permalink
adding node code
Browse files Browse the repository at this point in the history
  • Loading branch information
mbernst committed Dec 28, 2013
1 parent 4395ba9 commit 2c596c8
Show file tree
Hide file tree
Showing 19 changed files with 10,036 additions and 3 deletions.
2 changes: 1 addition & 1 deletion LICENSE
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2013 IntroHCI
Copyright (c) 2013 Stanford HCI

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: node server.js
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
lab2
Lab 2
====

Lab 2 for Intro to HCI
Lab 2 introduces you to static HTML, CSS, and Bootstrap.
Binary file removed images/lights.jpg
Binary file not shown.
20 changes: 20 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "cs147-lab-1",
"description": "Serving static content via html files",
"version": "0.0.1",
"author": "CS147 Staff <[email protected]>",

"repository": {
"type": "git",
"url": "https://github.com/StanfordHCI/cs147"
},
"license": "MIT",

"main": "server.js",
"dependencies": {
"express": "3.x"
},
"engines": {
"node": "0.10.x"
}
}
31 changes: 31 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* Introduction to Human-Computer Interaction
* Lab 1
* --------------
* Created by: Michael Bernstein
* Last updated: December 2013
*/
var PORT = 3000;

// Express is a web framework for node.js
// that makes nontrivial applications easier to build
var express = require('express');

// Create the server instance
var app = express();

// Print logs to the console and compress pages we send
app.use(express.logger());
app.use(express.compress());

// Return all pages in the /static directory
// whenever they are requested at '/'
// e.g., http://localhost:3000/index.html
// maps to /static/index.html on this machine
app.use(express.static(__dirname + '/static'));

// Start the server
var port = process.env.PORT || PORT; // 80 for web, 3000 for development
app.listen(port, function() {
console.log("Node.js server running on port %s", port);
});
Loading

0 comments on commit 2c596c8

Please sign in to comment.