mirror of
https://github.com/wassname/GarageServer.IO.git
synced 2026-09-11 11:53:23 +08:00
Initial commit of example app
This commit is contained in:
@@ -0,0 +1,35 @@
|
|||||||
|
|
||||||
|
/**
|
||||||
|
* Module dependencies.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var express = require('express')
|
||||||
|
, routes = require('./routes')
|
||||||
|
, user = require('./routes/user')
|
||||||
|
, http = require('http')
|
||||||
|
, path = require('path');
|
||||||
|
|
||||||
|
var app = express();
|
||||||
|
|
||||||
|
app.configure(function(){
|
||||||
|
app.set('port', process.env.PORT || 3000);
|
||||||
|
app.set('views', __dirname + '/views');
|
||||||
|
app.set('view engine', 'jade');
|
||||||
|
app.use(express.favicon());
|
||||||
|
app.use(express.logger('dev'));
|
||||||
|
app.use(express.bodyParser());
|
||||||
|
app.use(express.methodOverride());
|
||||||
|
app.use(app.router);
|
||||||
|
app.use(express.static(path.join(__dirname, 'public')));
|
||||||
|
});
|
||||||
|
|
||||||
|
app.configure('development', function(){
|
||||||
|
app.use(express.errorHandler());
|
||||||
|
});
|
||||||
|
|
||||||
|
app.get('/', routes.index);
|
||||||
|
app.get('/users', user.list);
|
||||||
|
|
||||||
|
http.createServer(app).listen(app.get('port'), function(){
|
||||||
|
console.log("Express server listening on port " + app.get('port'));
|
||||||
|
});
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
body {
|
||||||
|
padding: 50px;
|
||||||
|
font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #00B7FF;
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
|
||||||
|
/*
|
||||||
|
* GET home page.
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports.index = function(req, res){
|
||||||
|
res.render('index', { title: 'Express' });
|
||||||
|
};
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
|
||||||
|
/*
|
||||||
|
* GET users listing.
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports.list = function(req, res){
|
||||||
|
res.send("respond with a resource");
|
||||||
|
};
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
extends layout
|
||||||
|
|
||||||
|
block content
|
||||||
|
h1= title
|
||||||
|
p Welcome to #{title}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
doctype 5
|
||||||
|
html
|
||||||
|
head
|
||||||
|
title= title
|
||||||
|
link(rel='stylesheet', href='/stylesheets/style.css')
|
||||||
|
body
|
||||||
|
block content
|
||||||
Reference in New Issue
Block a user