-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added express, file structure updated
- Loading branch information
1 parent
df17f66
commit e96f4c1
Showing
27 changed files
with
112 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"directory": "client/components/", | ||
"directory": "public/components/", | ||
"timeout": 20000 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
{ | ||
"private": true, | ||
"dependencies": { | ||
"angular": "1.3.8", | ||
"todomvc-common": "^1.0.1", | ||
"todomvc-app-css": "^1.0.1" | ||
} | ||
} | ||
{ | ||
"private": true, | ||
"scripts": { | ||
"start": "node server" | ||
}, | ||
"dependencies": { | ||
"ejs": "2.4.2", | ||
"express": "4.13.4", | ||
"mongoose": "4.4.20", | ||
"todomvc-app-css": "^1.0.1", | ||
"todomvc-common": "^1.0.1" | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
|
||
'use strict'; | ||
|
||
var express = require('express'), | ||
path = require('path'), | ||
fs = require('fs'), | ||
config = require('./server/config/config'), | ||
mongoose = require('mongoose'); | ||
|
||
/** | ||
* Main application file | ||
*/ | ||
|
||
// Default node environment to development | ||
process.env.NODE_ENV = process.env.NODE_ENV || 'development'; | ||
|
||
// Connect to database | ||
var db = mongoose.connect(config.mongo.uri, config.mongo.options); | ||
|
||
var app = express(); | ||
|
||
// Express settings | ||
require('./server/config/express')(app); | ||
|
||
// Routing | ||
require('./server/routes')(app); | ||
|
||
|
||
// Start server | ||
app.listen(config.port, function () { | ||
console.log('Express server listening on port %d in %s mode', config.port, app.get('env')); | ||
}); | ||
|
||
// Expose app | ||
exports = module.exports = app; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
'use strict'; | ||
|
||
var rootPath = require('path').normalize(__dirname + '/../..'); | ||
|
||
/** | ||
* Load environment configuration | ||
*/ | ||
module.exports = { | ||
root: rootPath, | ||
env: 'development', | ||
port: process.env.PORT || 3000, | ||
mongo: { | ||
uri: 'mongodb://localhost/todo-dev', | ||
options: { | ||
db: { | ||
safe: true | ||
} | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
'use strict'; | ||
|
||
var express = require('express'), | ||
path = require('path'), | ||
config = require('./config'); | ||
/** | ||
* Express configuration | ||
*/ | ||
module.exports = function(app) { | ||
app.use(express.static(path.join(config.root, 'public'))); | ||
app.engine('html', require('ejs').renderFile); | ||
app.set('view engine', 'html'); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Send our single page app | ||
*/ | ||
module.exports = { | ||
index : function(req, res) { | ||
res.render('index'); | ||
} | ||
}; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
'use strict'; | ||
|
||
let express = require('express'); | ||
let router = express.Router(); | ||
|
||
let index = require('./controllers'); | ||
|
||
/** | ||
* Application routes | ||
*/ | ||
module.exports = function(app) { | ||
// All other routes to use Angular routing to default page | ||
app.get('/', index.index); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters