Permalink
Browse files

init

  • Loading branch information...
1 parent 5c9fdf9 commit cc78328ad11ad840d6dc43c3d063005635c1fe17 @etconsilium committed Nov 15, 2012
Showing with 173 additions and 2 deletions.
  1. +2 −0 .gitignore
  2. +5 −2 README.md
  3. +3 −0 dev.js
  4. +36 −0 package.json
  5. +1 −0 public/index.html
  6. +1 −0 public/robots.txt
  7. +8 −0 routes/index.js
  8. +37 −0 server/app.js
  9. +11 −0 server/globals.js
  10. +16 −0 server/index.js
  11. +8 −0 server/options.js
  12. +1 −0 views/404.ejs
  13. +4 −0 views/index.ejs
  14. +33 −0 views/layout.ejs
  15. +7 −0 views/options.js
View
@@ -12,3 +12,5 @@ logs
results
npm-debug.log
+
+node_modules
View
@@ -1,2 +1,5 @@
-nodejs-express-skeleton
-=======================
+Skeleton for Express' application
+=======================
+
+просто шаблон каталогов. сделано для себя.
+рекомендутся совместно с 99lime.com
View
3 dev.js
@@ -0,0 +1,3 @@
+if ('undefined' == typeof APPROOT) { APPROOT = __dirname; }
+
+require('./server/index.js').run();
View
@@ -0,0 +1,36 @@
+{
+ "name": "express.skeleton"
+ , "description": "express hello world"
+ , "url": "https://github.com/etconsilium/nodejs-express-skeleton"
+ , "keywords": [
+ ]
+ , "repository": {
+ "type": "git", "url": "git://github.com/etconsilium/nodejs-express-skeleton.git"
+ }
+ , "version": "1.1.111"
+ , "license": "BSDL.v2"
+ , "author": {
+ "name": "VS"
+ }
+ , "scripts": { "start": "node server.js" }
+ , "dependencies": {
+ "express": "2.5.9"
+ , "ejs": "*"
+ , "mongoskin": "*"
+ , "string": "*"
+ , "phpjs": "*"
+ , "underscore": "*"
+ , "util": "*"
+ , "object.extend": "*"
+ }
+ , "engines": {
+ "node": ">=0.4"
+ }
+
+ , "devDependencies": {
+ "mocha": "*"
+ , "should": "*"
+ , "supertest": "*"
+ }
+
+}
View
@@ -0,0 +1 @@
+<h1>Hi!</hi>
View
@@ -0,0 +1 @@
+disallow *
View
@@ -0,0 +1,8 @@
+
+/*
+ * GET home page.
+ */
+
+exports.index = function(req, res){
+ res.render('index', { title: 'Express' });
+};
View
@@ -0,0 +1,37 @@
+
+var o = options = require('./options.js');
+var app = express.createServer( /*{параметры https}*/ );
+app.o = app.options = options;
+
+app.configure( function () {
+ app.set('port', app.o.port);
+ app.set('view engine', app.o['view engine']);
+ app.set('views', app.o.view);
+ app.set('view layout', app.o['view layout']);
+ app.set('view options', app.o['view options']);
+
+ app.use(express.favicon());
+
+ // не требуются, если сверху стоит веб-сервер
+ //app.use(express.methodOverride());
+ //app.use(express.static(path.join(__dirname, 'public')));
+
+ app.use(express.logger('dev'));
+ app.use(express.static(APPROOT + '/public')); // если не требуется обработка, парсинг, сессии и роутинг, то надо здесь
+
+ app.use(express.bodyParser());
+ app.use(express.cookieParser());
+ app.use(express.session({ secret: 'auth_mode'}));
+
+ app.use(app.router);
+ // app.use(express.static(APPROOT + '/public'));
+ app.use(express.errorHandler());
+
+});
+
+
+app.configure('development', function(){
+ app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
+});
+
+module.exports=app;
View
@@ -0,0 +1,11 @@
+_ = $_ = require('underscore');
+$extend = require('object.extend');
+$php = require('phpjs');
+$s = require('string');
+
+fs = require('fs');
+util = require('util');
+
+express = require('express');
+
+mongo = new require('mongodbskin');
View
@@ -0,0 +1,16 @@
+if ('undefined' == typeof APPROOT) { APPROOT = __dirname+'/..'; }
+require('./globals.js');
+
+exports.run = function(){
+var app = require('./app.js');
+ // роуты здесь
+ app.get('/', function(req,res){res.render('index')});
+
+ // 404 etc
+ app.get('*', function(req, res) {
+ res.send('El pueblo unido jamás será vencido', 451);
+ });
+
+ console.log('server run');
+ app.listen(app.o.port||8888, app.o.host||'0.0.0.0');
+}
View
@@ -0,0 +1,8 @@
+module.exports = {
+ 'port' : 8888
+ ,'host' : '0.0.0.0' // хост должен быть нормальным хостом, потому что в днс.жс нет обёртки
+ ,'view engine' : 'ejs'
+ ,'view' : APPROOT + '/views' // как-то это наколенно и костыляво
+ ,'view layout': true
+ ,'view options': require(APPROOT + '/views/options.js').total // ejs не понимает "вложенных объектов", только скаляры и вектора.
+}
View
@@ -0,0 +1 @@
+Shit Happends
View
@@ -0,0 +1,4 @@
+ <div id="intro" class="col_12 center">
+ <h2>Kickstart <a href="http://www.99lime.com"></h2>
+ </div><hr />
+ <div class="clearfix"></div>
View
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html><head>
+<title><%=title%></title>
+<meta charset="<%=charset%>">
+<meta name="description" content="<%=description%>">
+<script>
+ if (!jQuery) document.writeln('<sc'+'ript type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></sc'+'ript>');
+ if (!jQuery) document.writeln('<sc'+'ript type="text/javascript" src="//code.jquery.com/jquery-latest.min.js"></sc'+'ript>');
+ if (!jQuery) document.writeln('<sc'+'ript type="text/javascript" src="//'+window.location.hostname+'/js/jquery.min.js"></sc'+'ript>');
+ if (!jQuery) location.href='/no.jquery.html';
+</script>
+<!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
+<script type="text/javascript" src="/99L/js/prettify.js"></script>
+<script type="text/javascript" src="/99L/js/kickstart.js"></script>
+<link rel="stylesheet" type="text/css" href="/99L/css/kickstart.css" media="all" />
+<link rel="stylesheet" type="text/css" href="/99L/box-shadow.css" media="all" />
+<link rel="stylesheet" type="text/css" href="/99L/style.css" media="all" />
+</head>
+<body>
+<a id="top-of-page"></a>
+<div id="wrap" class="clearfix">
+ <%- body %>
+ <div id="footer">
+ (cc-by-na) <a href="">VS</a> 2011–2012 .
+ Powered by <a href="http://www.99lime.com">99 Lime</a>
+ , <a href="http://www.nodejs.org">NodeJS</a>
+ , <a href="https://github.com/etconsilium/">GitHub</a>
+ , <a href="http://www.sublimetext.com">SubLimeText2</a>
+ <a id="link-top" href="#top-of-page">Top</a>
+ </div>
+</div>
+<div class="clear"></div>
+</body></html>
View
@@ -0,0 +1,7 @@
+module.exports={
+ "total":{
+ charset:'utf-8'
+ ,title:'Express Application Skeleton'
+ ,description:'Free & OpenSource'
+ }
+}

0 comments on commit cc78328

Please sign in to comment.