-
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.
- Loading branch information
0 parents
commit c266402
Showing
20 changed files
with
422 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"directory": "client/bower_components" | ||
} |
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,9 @@ | ||
.idea | ||
.env | ||
node_modules | ||
client/node_modules | ||
client/bower_components | ||
npm-debug.* | ||
link-checker-results.txt | ||
client/app/**/*.js | ||
*.js.map |
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,57 @@ | ||
var express = require('express'); | ||
var path = require('path'); | ||
var favicon = require('serve-favicon'); | ||
var logger = require('morgan'); | ||
var cookieParser = require('cookie-parser'); | ||
var bodyParser = require('body-parser'); | ||
|
||
// init Mongoose schemas & init db through Mongoose | ||
require('./models/thing') | ||
var mongoose = require('mongoose'); | ||
mongoose.connect('mongodb://' + | ||
process.env.DB_HOST + | ||
'/' + | ||
process.env.DB_NAME); | ||
|
||
var index = require('./routes/index'); | ||
var api = require('./routes/api'); | ||
|
||
var app = express(); | ||
|
||
// view engine setup | ||
app.set('views', path.join(__dirname, 'views')); | ||
app.set('view engine', 'ejs'); | ||
// added from tutorial | ||
app.engine('html', require('ejs').renderFile); | ||
|
||
// uncomment after placing your favicon in /public | ||
//app.use(favicon(path.join(__dirname, 'public', 'favicon.ico'))); | ||
app.use(logger('dev')); | ||
app.use(bodyParser.json()); | ||
app.use(bodyParser.urlencoded({ extended: false })); | ||
app.use(cookieParser()); | ||
// set static folder (Angular 2 stuff) | ||
app.use(express.static(path.join(__dirname, 'client'))); | ||
|
||
app.use('/', index); | ||
app.use('/api', api); | ||
|
||
// catch 404 and forward to error handler | ||
app.use(function(req, res, next) { | ||
var err = new Error('Not Found'); | ||
err.status = 404; | ||
next(err); | ||
}); | ||
|
||
// error handler | ||
app.use(function(err, req, res, next) { | ||
// set locals, only providing error in development | ||
res.locals.message = err.message; | ||
res.locals.error = req.app.get('env') === 'development' ? err : {}; | ||
|
||
// render the error page | ||
res.status(err.status || 500); | ||
res.render('error'); | ||
}); | ||
|
||
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,91 @@ | ||
#!/usr/bin/env node | ||
|
||
/** | ||
* Module dependencies. | ||
*/ | ||
|
||
var app = require('../app'); | ||
var debug = require('debug')('mean-seed:server'); | ||
var http = require('http'); | ||
|
||
/** | ||
* Get port from environment and store in Express. | ||
*/ | ||
|
||
var port = normalizePort(process.env.PORT); | ||
app.set('port', port); | ||
|
||
/** | ||
* Create HTTP server. | ||
*/ | ||
|
||
var server = http.createServer(app); | ||
|
||
/** | ||
* Listen on provided port, on all network interfaces. | ||
*/ | ||
|
||
server.listen(port); | ||
server.on('error', onError); | ||
server.on('listening', onListening); | ||
|
||
/** | ||
* Normalize a port into a number, string, or false. | ||
*/ | ||
|
||
function normalizePort(val) { | ||
var port = parseInt(val, 10); | ||
|
||
if (isNaN(port)) { | ||
// named pipe | ||
return val; | ||
} | ||
|
||
if (port >= 0) { | ||
// port number | ||
return port; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
/** | ||
* Event listener for HTTP server "error" event. | ||
*/ | ||
|
||
function onError(error) { | ||
if (error.syscall !== 'listen') { | ||
throw error; | ||
} | ||
|
||
var bind = typeof port === 'string' | ||
? 'Pipe ' + port | ||
: 'Port ' + port; | ||
|
||
// handle specific listen errors with friendly messages | ||
switch (error.code) { | ||
case 'EACCES': | ||
console.error(bind + ' requires elevated privileges'); | ||
process.exit(1); | ||
break; | ||
case 'EADDRINUSE': | ||
console.error(bind + ' is already in use'); | ||
process.exit(1); | ||
break; | ||
default: | ||
throw error; | ||
} | ||
} | ||
|
||
/** | ||
* Event listener for HTTP server "listening" event. | ||
*/ | ||
|
||
function onListening() { | ||
var addr = server.address(); | ||
var bind = typeof addr === 'string' | ||
? 'pipe ' + addr | ||
: 'port ' + addr.port; | ||
debug('Listening on ' + bind); | ||
console.log('Server listening on port: ' + port); | ||
} |
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,5 @@ | ||
<div class="container"> | ||
<h1>Hello, {{name}}</h1> | ||
<hr> | ||
<p>{{description}}</p> | ||
</div> |
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 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
moduleId: module.id, // use this in order to use relative paths | ||
selector: 'my-app', | ||
//template: `<h1>Hello {{name}}</h1>`, | ||
templateUrl: 'app.component.html' | ||
}) | ||
export class AppComponent { | ||
name: string = 'Angular'; | ||
description: string = 'Start from here! This is the root component!'; | ||
|
||
} |
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,11 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { BrowserModule } from '@angular/platform-browser'; | ||
|
||
import { AppComponent } from './app.component'; | ||
|
||
@NgModule({ | ||
imports: [ BrowserModule ], | ||
declarations: [ AppComponent ], | ||
bootstrap: [ AppComponent ] | ||
}) | ||
export class AppModule { } |
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,5 @@ | ||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; | ||
|
||
import { AppModule } from './app.module'; | ||
|
||
platformBrowserDynamic().bootstrapModule(AppModule); |
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,15 @@ | ||
/* | ||
* Template of a service | ||
*/ | ||
|
||
import { Injectable } from '@angular/core'; | ||
import { Http, Headers} from '@angular/http'; | ||
import 'rxjs/add/operator/map'; | ||
|
||
@Injectable() | ||
export class Service { | ||
|
||
constructor(private http: Http) { | ||
// code... | ||
} | ||
} |
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,57 @@ | ||
{ | ||
"name": "mean-seed", | ||
"version": "1.0.0", | ||
"description": "QuickStart package.json from the documentation, supplemented with testing support", | ||
"scripts": { | ||
"start": "tsc && tsc -w ", | ||
"e2e": "tsc && concurrently \"http-server -s\" \"protractor protractor.config.js\" --kill-others --success first", | ||
"lint": "tslint ./app/**/*.ts -t verbose", | ||
"lite": "lite-server", | ||
"pree2e": "webdriver-manager update", | ||
"test": "tsc && concurrently \"tsc -w\" \"karma start karma.conf.js\"", | ||
"test-once": "tsc && karma start karma.conf.js --single-run", | ||
"tsc": "tsc", | ||
"tsc:w": "tsc -w" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "MIT", | ||
"dependencies": { | ||
"@angular/common": "~2.4.0", | ||
"@angular/compiler": "~2.4.0", | ||
"@angular/core": "~2.4.0", | ||
"@angular/forms": "~2.4.0", | ||
"@angular/http": "~2.4.0", | ||
"@angular/platform-browser": "~2.4.0", | ||
"@angular/platform-browser-dynamic": "~2.4.0", | ||
"@angular/router": "~3.4.0", | ||
|
||
"angular-in-memory-web-api": "~0.2.4", | ||
"systemjs": "0.19.40", | ||
"core-js": "^2.4.1", | ||
"rxjs": "5.0.1", | ||
"zone.js": "^0.7.4" | ||
}, | ||
"devDependencies": { | ||
"concurrently": "^3.1.0", | ||
"lite-server": "^2.2.2", | ||
"typescript": "~2.0.10", | ||
|
||
"canonical-path": "0.0.2", | ||
"http-server": "^0.9.0", | ||
"tslint": "^3.15.1", | ||
"lodash": "^4.16.4", | ||
"jasmine-core": "~2.4.1", | ||
"karma": "^1.3.0", | ||
"karma-chrome-launcher": "^2.0.0", | ||
"karma-cli": "^1.0.1", | ||
"karma-jasmine": "^1.0.2", | ||
"karma-jasmine-html-reporter": "^0.2.2", | ||
"protractor": "~4.0.14", | ||
"rimraf": "^2.5.4", | ||
|
||
"@types/node": "^6.0.46", | ||
"@types/jasmine": "^2.5.36" | ||
}, | ||
"repository": {} | ||
} |
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,5 @@ | ||
h1 { | ||
color: #369; | ||
font-family: Arial, Helvetica, sans-serif; | ||
font-size: 250%; | ||
} |
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,41 @@ | ||
/** | ||
* System configuration for Angular samples | ||
* Adjust as necessary for your application needs. | ||
*/ | ||
(function (global) { | ||
System.config({ | ||
paths: { | ||
// paths serve as alias | ||
'npm:': 'node_modules/' | ||
}, | ||
// map tells the System loader where to look for things | ||
map: { | ||
// our app is within the app folder | ||
app: 'app', | ||
|
||
// angular bundles | ||
'@angular/core': 'npm:@angular/core/bundles/core.umd.js', | ||
'@angular/common': 'npm:@angular/common/bundles/common.umd.js', | ||
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js', | ||
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js', | ||
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js', | ||
'@angular/http': 'npm:@angular/http/bundles/http.umd.js', | ||
'@angular/router': 'npm:@angular/router/bundles/router.umd.js', | ||
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js', | ||
|
||
// other libraries | ||
'rxjs': 'npm:rxjs', | ||
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js' | ||
}, | ||
// packages tells the System loader how to load when no filename and/or no extension | ||
packages: { | ||
app: { | ||
main: './main.js', | ||
defaultExtension: 'js' | ||
}, | ||
rxjs: { | ||
defaultExtension: 'js' | ||
} | ||
} | ||
}); | ||
})(this); |
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 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es5", | ||
"module": "commonjs", | ||
"moduleResolution": "node", | ||
"sourceMap": true, | ||
"emitDecoratorMetadata": true, | ||
"experimentalDecorators": true, | ||
"lib": [ "es2015", "dom" ], | ||
"noImplicitAny": true, | ||
"suppressImplicitAnyIndexErrors": 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,7 @@ | ||
{ | ||
"globalDependencies": { | ||
"core-js": "registry:dt/core-js#0.0.0+20160725163759", | ||
"jasmine": "registry:dt/jasmine#2.2.0+20160621224255", | ||
"node": "registry:dt/node#6.0.0+20160909174046" | ||
} | ||
} |
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 @@ | ||
var mongoose = require('mongoose'); | ||
var Schema = mongoose.Schema; | ||
|
||
/* | ||
* Example of a schema definition: | ||
var userSchema = new mongoose.Schema({ | ||
username: String, | ||
password: String, //hash created from password | ||
created_at: {type: Date, default: Date.now} | ||
}); | ||
mongoose.model('Thing', userSchema); // this will create a 'users' collection @ process.env.DB_NAME if it does not exists | ||
*/ |
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,24 @@ | ||
{ | ||
"name": "mean-seed", | ||
"version": "0.0.0", | ||
"description": "Quickstart seed for implementing a MEAN project", | ||
"private": true, | ||
"scripts": { | ||
"start-server": "node -r dotenv/config ./bin/www", | ||
"start-client": "cd client/ && npm start", | ||
"start": "concurrently --kill-others \"npm run start-server\" \"npm run start-client\"" | ||
}, | ||
"dependencies": { | ||
"body-parser": "~1.15.2", | ||
"concurrently": "^3.1.0", | ||
"cookie-parser": "~1.4.3", | ||
"debug": "~2.2.0", | ||
"dotenv": "^2.0.0", | ||
"ejs": "~2.5.2", | ||
"express": "~4.14.0", | ||
"mongoose": "^4.7.6", | ||
"morgan": "~1.7.0", | ||
"serve-favicon": "~2.3.0" | ||
}, | ||
"author": "Luciano Perezzini" | ||
} |
Oops, something went wrong.