├── .gitignore ├── LICENSE ├── README.md ├── _old ├── step0_hello_express │ ├── .gitignore │ ├── built │ │ └── server.js │ ├── gulpfile.js │ ├── package.json │ ├── readme.md │ ├── src │ │ └── server.ts │ ├── tsconfig.json │ ├── tsd.json │ ├── typings │ │ ├── express │ │ │ └── express.d.ts │ │ ├── mime │ │ │ └── mime.d.ts │ │ ├── node │ │ │ └── node.d.ts │ │ ├── serve-static │ │ │ └── serve-static.d.ts │ │ └── tsd.d.ts │ └── views │ │ └── index.ejs ├── step10_url-parameters │ ├── .gitignore │ ├── .vscode │ │ └── tasks.json │ ├── built │ │ └── server.js │ ├── gulpfile.js │ ├── package.json │ ├── public │ │ └── img │ │ │ └── typescript.png │ ├── readme.md │ ├── src │ │ └── server.ts │ ├── tsconfig.json │ ├── tsd.json │ ├── typings │ │ ├── body-parser │ │ │ └── body-parser.d.ts │ │ ├── express │ │ │ └── express.d.ts │ │ ├── mime │ │ │ └── mime.d.ts │ │ ├── morgan │ │ │ └── morgan.d.ts │ │ ├── node │ │ │ └── node.d.ts │ │ ├── serve-static │ │ │ └── serve-static.d.ts │ │ └── tsd.d.ts │ └── views │ │ └── index.ejs ├── step11_post-bodyparser │ ├── .gitignore │ ├── .vscode │ │ └── tasks.json │ ├── built │ │ └── server.js │ ├── gulpfile.js │ ├── package.json │ ├── public │ │ └── img │ │ │ └── typescript.png │ ├── readme.md │ ├── src │ │ └── server.ts │ ├── tsconfig.json │ ├── tsd.json │ ├── typings │ │ ├── body-parser │ │ │ └── body-parser.d.ts │ │ ├── express │ │ │ └── express.d.ts │ │ ├── mime │ │ │ └── mime.d.ts │ │ ├── morgan │ │ │ └── morgan.d.ts │ │ ├── node │ │ │ └── node.d.ts │ │ ├── serve-static │ │ │ └── serve-static.d.ts │ │ └── tsd.d.ts │ └── views │ │ └── index.ejs ├── step12_express-session │ ├── .gitignore │ ├── .vscode │ │ └── tasks.json │ ├── built │ │ └── server.js │ ├── gulpfile.js │ ├── package.json │ ├── public │ │ └── img │ │ │ └── typescript.png │ ├── readme.md │ ├── src │ │ └── server.ts │ ├── tsconfig.json │ ├── tsd.json │ ├── typings │ │ ├── body-parser │ │ │ └── body-parser.d.ts │ │ ├── custom.d.ts │ │ ├── express-session │ │ │ └── express-session.d.ts │ │ ├── express │ │ │ └── express.d.ts │ │ ├── mime │ │ │ └── mime.d.ts │ │ ├── morgan │ │ │ └── morgan.d.ts │ │ ├── node │ │ │ └── node.d.ts │ │ ├── serve-static │ │ │ └── serve-static.d.ts │ │ └── tsd.d.ts │ └── views │ │ └── index.ejs ├── step13_rest-api │ ├── .gitignore │ ├── .vscode │ │ └── tasks.json │ ├── built │ │ └── server.js │ ├── gulpfile.js │ ├── package.json │ ├── public │ │ └── img │ │ │ └── typescript.png │ ├── readme.md │ ├── src │ │ └── server.ts │ ├── tsconfig.json │ ├── tsd.json │ ├── typings │ │ ├── body-parser │ │ │ └── body-parser.d.ts │ │ ├── custom.d.ts │ │ ├── express-session │ │ │ └── express-session.d.ts │ │ ├── express │ │ │ └── express.d.ts │ │ ├── mime │ │ │ └── mime.d.ts │ │ ├── morgan │ │ │ └── morgan.d.ts │ │ ├── node │ │ │ └── node.d.ts │ │ ├── serve-static │ │ │ └── serve-static.d.ts │ │ └── tsd.d.ts │ └── views │ │ └── index.ejs ├── step14_mongodb-insert │ ├── .gitignore │ ├── .vscode │ │ └── tasks.json │ ├── built │ │ └── server.js │ ├── gulpfile.js │ ├── package.json │ ├── public │ │ └── img │ │ │ └── typescript.png │ ├── readme.md │ ├── src │ │ └── server.ts │ ├── tsconfig.json │ ├── tsd.json │ ├── typings │ │ ├── body-parser │ │ │ └── body-parser.d.ts │ │ ├── custom.d.ts │ │ ├── express-session │ │ │ └── express-session.d.ts │ │ ├── express │ │ │ └── express.d.ts │ │ ├── mime │ │ │ └── mime.d.ts │ │ ├── mongoose │ │ │ └── mongoose.d.ts │ │ ├── morgan │ │ │ └── morgan.d.ts │ │ ├── node │ │ │ └── node.d.ts │ │ ├── serve-static │ │ │ └── serve-static.d.ts │ │ └── tsd.d.ts │ └── views │ │ └── index.ejs ├── step15_mongodb-find │ ├── .gitignore │ ├── .vscode │ │ └── tasks.json │ ├── built │ │ └── server.js │ ├── gulpfile.js │ ├── package.json │ ├── public │ │ └── img │ │ │ └── typescript.png │ ├── readme.md │ ├── src │ │ └── server.ts │ ├── tsconfig.json │ ├── tsd.json │ ├── typings │ │ ├── body-parser │ │ │ └── body-parser.d.ts │ │ ├── custom.d.ts │ │ ├── express-session │ │ │ └── express-session.d.ts │ │ ├── express │ │ │ └── express.d.ts │ │ ├── mime │ │ │ └── mime.d.ts │ │ ├── mongoose │ │ │ └── mongoose.d.ts │ │ ├── morgan │ │ │ └── morgan.d.ts │ │ ├── node │ │ │ └── node.d.ts │ │ ├── serve-static │ │ │ └── serve-static.d.ts │ │ └── tsd.d.ts │ └── views │ │ └── index.ejs ├── step16_mongodb-remove │ ├── .gitignore │ ├── .vscode │ │ └── tasks.json │ ├── built │ │ └── server.js │ ├── gulpfile.js │ ├── package.json │ ├── public │ │ └── img │ │ │ └── typescript.png │ ├── readme.md │ ├── src │ │ └── server.ts │ ├── tsconfig.json │ ├── tsd.json │ ├── typings │ │ ├── body-parser │ │ │ └── body-parser.d.ts │ │ ├── custom.d.ts │ │ ├── express-session │ │ │ └── express-session.d.ts │ │ ├── express │ │ │ └── express.d.ts │ │ ├── mime │ │ │ └── mime.d.ts │ │ ├── mongoose │ │ │ └── mongoose.d.ts │ │ ├── morgan │ │ │ └── morgan.d.ts │ │ ├── node │ │ │ └── node.d.ts │ │ ├── serve-static │ │ │ └── serve-static.d.ts │ │ └── tsd.d.ts │ └── views │ │ └── index.ejs ├── step17_mongodb-update │ ├── .gitignore │ ├── .vscode │ │ └── tasks.json │ ├── built │ │ └── server.js │ ├── gulpfile.js │ ├── package.json │ ├── public │ │ └── img │ │ │ └── typescript.png │ ├── readme.md │ ├── src │ │ └── server.ts │ ├── tsconfig.json │ ├── tsd.json │ ├── typings │ │ ├── body-parser │ │ │ └── body-parser.d.ts │ │ ├── custom.d.ts │ │ ├── express-session │ │ │ └── express-session.d.ts │ │ ├── express │ │ │ └── express.d.ts │ │ ├── mime │ │ │ └── mime.d.ts │ │ ├── mongoose │ │ │ └── mongoose.d.ts │ │ ├── morgan │ │ │ └── morgan.d.ts │ │ ├── node │ │ │ └── node.d.ts │ │ ├── serve-static │ │ │ └── serve-static.d.ts │ │ └── tsd.d.ts │ └── views │ │ └── index.ejs ├── step18_mongodb │ ├── .gitignore │ ├── bower.json │ ├── built │ │ ├── db.js │ │ ├── models │ │ │ ├── IUser.js │ │ │ └── User.js │ │ ├── routes │ │ │ ├── api │ │ │ │ └── createUser.js │ │ │ ├── createUserForm.js │ │ │ └── index.js │ │ └── server.js │ ├── gulpfile.js │ ├── package.json │ ├── public │ │ ├── css │ │ │ └── main.css │ │ ├── img │ │ │ └── typescript.png │ │ └── js │ │ │ └── createUserForm.js │ ├── readme.md │ ├── sass │ │ ├── globals │ │ │ └── variables.scss │ │ ├── main.scss │ │ └── mystyles │ │ │ ├── body.scss │ │ │ ├── extend.scss │ │ │ └── panel.scss │ ├── src │ │ ├── db.ts │ │ ├── models │ │ │ ├── IUser.ts │ │ │ └── User.ts │ │ ├── routes │ │ │ ├── api │ │ │ │ └── createUser.ts │ │ │ ├── createUserForm.ts │ │ │ └── index.ts │ │ └── server.ts │ ├── tsconfig.json │ ├── tsd.json │ ├── typings │ │ ├── body-parser │ │ │ └── body-parser.d.ts │ │ ├── es6-promise │ │ │ └── es6-promise.d.ts │ │ ├── express │ │ │ └── express.d.ts │ │ ├── mime │ │ │ └── mime.d.ts │ │ ├── mongoose │ │ │ └── mongoose.d.ts │ │ ├── morgan │ │ │ └── morgan.d.ts │ │ ├── node │ │ │ └── node.d.ts │ │ ├── serve-static │ │ │ └── serve-static.d.ts │ │ ├── tsd.d.ts │ │ └── whatwg-fetch │ │ │ └── whatwg-fetch.d.ts │ ├── views │ │ ├── createUserForm.ejs │ │ └── index.ejs │ └── viewsSrc │ │ └── createUserForm.ts ├── step19_sass │ ├── .gitignore │ ├── built │ │ ├── routes │ │ │ ├── index.js │ │ │ └── second.js │ │ └── server.js │ ├── gulpfile.js │ ├── package.json │ ├── public │ │ ├── css │ │ │ └── mystyles.css │ │ └── img │ │ │ └── typescript.png │ ├── readme.md │ ├── sass │ │ └── mystyles.scss │ ├── src │ │ ├── routes │ │ │ ├── index.ts │ │ │ └── second.ts │ │ └── server.ts │ ├── tsconfig.json │ ├── tsd.json │ ├── typings │ │ ├── body-parser │ │ │ └── body-parser.d.ts │ │ ├── express │ │ │ └── express.d.ts │ │ ├── mime │ │ │ └── mime.d.ts │ │ ├── morgan │ │ │ └── morgan.d.ts │ │ ├── node │ │ │ └── node.d.ts │ │ ├── serve-static │ │ │ └── serve-static.d.ts │ │ └── tsd.d.ts │ └── views │ │ ├── index.ejs │ │ └── page2.ejs ├── step1_image │ ├── .gitignore │ ├── built │ │ └── server.js │ ├── gulpfile.js │ ├── package.json │ ├── public │ │ └── img │ │ │ └── typescript.png │ ├── readme.md │ ├── src │ │ └── server.ts │ ├── tsconfig.json │ ├── tsd.json │ ├── typings │ │ ├── body-parser │ │ │ └── body-parser.d.ts │ │ ├── express │ │ │ └── express.d.ts │ │ ├── mime │ │ │ └── mime.d.ts │ │ ├── morgan │ │ │ └── morgan.d.ts │ │ ├── node │ │ │ └── node.d.ts │ │ ├── serve-static │ │ │ └── serve-static.d.ts │ │ └── tsd.d.ts │ └── views │ │ └── index.ejs ├── step20_bootstrap │ ├── .gitignore │ ├── bower.json │ ├── built │ │ ├── routes │ │ │ ├── index.js │ │ │ └── second.js │ │ └── server.js │ ├── gulpfile.js │ ├── package.json │ ├── public │ │ ├── css │ │ │ └── main.css │ │ └── img │ │ │ └── typescript.png │ ├── readme.md │ ├── sass │ │ ├── main.scss │ │ └── mystyles │ │ │ ├── body.scss │ │ │ └── panel.scss │ ├── src │ │ ├── routes │ │ │ ├── index.ts │ │ │ └── second.ts │ │ └── server.ts │ ├── tsconfig.json │ ├── tsd.json │ ├── typings │ │ ├── body-parser │ │ │ └── body-parser.d.ts │ │ ├── express │ │ │ └── express.d.ts │ │ ├── mime │ │ │ └── mime.d.ts │ │ ├── morgan │ │ │ └── morgan.d.ts │ │ ├── node │ │ │ └── node.d.ts │ │ ├── serve-static │ │ │ └── serve-static.d.ts │ │ └── tsd.d.ts │ └── views │ │ ├── index.ejs │ │ └── page2.ejs ├── step21_bootstrap_override │ ├── .gitignore │ ├── bower.json │ ├── built │ │ ├── routes │ │ │ ├── index.js │ │ │ └── second.js │ │ └── server.js │ ├── gulpfile.js │ ├── package.json │ ├── public │ │ ├── css │ │ │ └── main.css │ │ └── img │ │ │ └── typescript.png │ ├── readme.md │ ├── sass │ │ ├── globals │ │ │ └── variables.scss │ │ ├── main.scss │ │ └── mystyles │ │ │ ├── body.scss │ │ │ └── panel.scss │ ├── src │ │ ├── routes │ │ │ ├── index.ts │ │ │ └── second.ts │ │ └── server.ts │ ├── tsconfig.json │ ├── tsd.json │ ├── typings │ │ ├── body-parser │ │ │ └── body-parser.d.ts │ │ ├── express │ │ │ └── express.d.ts │ │ ├── mime │ │ │ └── mime.d.ts │ │ ├── morgan │ │ │ └── morgan.d.ts │ │ ├── node │ │ │ └── node.d.ts │ │ ├── serve-static │ │ │ └── serve-static.d.ts │ │ └── tsd.d.ts │ └── views │ │ ├── index.ejs │ │ └── page2.ejs ├── step22_bootstrap_extend │ ├── .gitignore │ ├── bower.json │ ├── built │ │ ├── routes │ │ │ ├── index.js │ │ │ └── second.js │ │ └── server.js │ ├── gulpfile.js │ ├── package.json │ ├── public │ │ ├── css │ │ │ └── main.css │ │ └── img │ │ │ └── typescript.png │ ├── readme.md │ ├── sass │ │ ├── globals │ │ │ └── variables.scss │ │ ├── main.scss │ │ └── mystyles │ │ │ ├── body.scss │ │ │ ├── extend.scss │ │ │ └── panel.scss │ ├── src │ │ ├── routes │ │ │ ├── index.ts │ │ │ └── second.ts │ │ └── server.ts │ ├── tsconfig.json │ ├── tsd.json │ ├── typings │ │ ├── body-parser │ │ │ └── body-parser.d.ts │ │ ├── express │ │ │ └── express.d.ts │ │ ├── mime │ │ │ └── mime.d.ts │ │ ├── morgan │ │ │ └── morgan.d.ts │ │ ├── node │ │ │ └── node.d.ts │ │ ├── serve-static │ │ │ └── serve-static.d.ts │ │ └── tsd.d.ts │ └── views │ │ ├── index.ejs │ │ └── page2.ejs ├── step23_es2015_modules │ ├── .gitignore │ ├── bower.json │ ├── built │ │ ├── models │ │ │ └── User.js │ │ ├── routes │ │ │ ├── index.js │ │ │ └── second.js │ │ └── server.js │ ├── gulpfile.js │ ├── package.json │ ├── public │ │ ├── css │ │ │ └── main.css │ │ └── img │ │ │ └── typescript.png │ ├── readme.md │ ├── sass │ │ ├── globals │ │ │ └── variables.scss │ │ ├── main.scss │ │ └── mystyles │ │ │ ├── body.scss │ │ │ ├── extend.scss │ │ │ └── panel.scss │ ├── src │ │ ├── models │ │ │ └── User.ts │ │ ├── routes │ │ │ ├── index.ts │ │ │ └── second.ts │ │ └── server.ts │ ├── tsconfig.json │ ├── tsd.json │ ├── typings │ │ ├── body-parser │ │ │ └── body-parser.d.ts │ │ ├── express │ │ │ └── express.d.ts │ │ ├── mime │ │ │ └── mime.d.ts │ │ ├── morgan │ │ │ └── morgan.d.ts │ │ ├── node │ │ │ └── node.d.ts │ │ ├── serve-static │ │ │ └── serve-static.d.ts │ │ └── tsd.d.ts │ └── views │ │ ├── index.ejs │ │ └── page2.ejs ├── step24_angular2 │ ├── .gitignore │ ├── dist │ │ ├── client │ │ │ ├── app │ │ │ │ └── app.js │ │ │ ├── index.html │ │ │ └── lib │ │ │ │ ├── angular2.dev.js │ │ │ │ └── system.src.js │ │ └── server │ │ │ └── app.js │ ├── gulpfile.js │ ├── gulpfile.ts │ ├── npm-debug.log │ ├── package.json │ ├── readme.md │ ├── src │ │ ├── client │ │ │ ├── app │ │ │ │ └── app.ts │ │ │ ├── index.html │ │ │ └── tsconfig.json │ │ └── server │ │ │ ├── app.ts │ │ │ ├── tsconfig.json │ │ │ ├── tsd.json │ │ │ └── typings │ │ │ ├── express │ │ │ └── express.d.ts │ │ │ ├── mime │ │ │ └── mime.d.ts │ │ │ ├── node │ │ │ └── node.d.ts │ │ │ ├── serve-static │ │ │ └── serve-static.d.ts │ │ │ └── tsd.d.ts │ ├── tsconfig.json │ ├── tsd.json │ └── typings │ │ ├── gulp-nodemon │ │ └── gulp-nodemon.d.ts │ │ ├── gulp-typescript │ │ └── gulp-typescript.d.ts │ │ ├── gulp │ │ └── gulp.d.ts │ │ ├── node │ │ └── node.d.ts │ │ ├── orchestrator │ │ └── orchestrator.d.ts │ │ ├── q │ │ └── Q.d.ts │ │ ├── rimraf │ │ └── rimraf.d.ts │ │ └── tsd.d.ts ├── step25_angular2_sass │ ├── .gitignore │ ├── dist │ │ ├── client │ │ │ ├── app │ │ │ │ ├── app.css │ │ │ │ └── app.js │ │ │ ├── index.html │ │ │ └── lib │ │ │ │ ├── angular2.dev.js │ │ │ │ └── system.src.js │ │ └── server │ │ │ └── app.js │ ├── gulpfile.js │ ├── gulpfile.ts │ ├── package.json │ ├── readme.md │ ├── src │ │ ├── client │ │ │ ├── app │ │ │ │ ├── app.scss │ │ │ │ └── app.ts │ │ │ ├── index.html │ │ │ └── tsconfig.json │ │ └── server │ │ │ ├── app.ts │ │ │ ├── tsconfig.json │ │ │ ├── tsd.json │ │ │ └── typings │ │ │ ├── express │ │ │ └── express.d.ts │ │ │ ├── mime │ │ │ └── mime.d.ts │ │ │ ├── node │ │ │ └── node.d.ts │ │ │ ├── serve-static │ │ │ └── serve-static.d.ts │ │ │ └── tsd.d.ts │ ├── tsconfig.json │ ├── tsd.json │ └── typings │ │ ├── gulp-nodemon │ │ └── gulp-nodemon.d.ts │ │ ├── gulp-sass │ │ └── gulp-sass.d.ts │ │ ├── gulp-typescript │ │ └── gulp-typescript.d.ts │ │ ├── gulp │ │ └── gulp.d.ts │ │ ├── node │ │ └── node.d.ts │ │ ├── orchestrator │ │ └── orchestrator.d.ts │ │ ├── q │ │ └── Q.d.ts │ │ ├── rimraf │ │ └── rimraf.d.ts │ │ └── tsd.d.ts ├── step26_angular2_sass_mocha │ ├── .gitignore │ ├── dist │ │ ├── client │ │ │ ├── app │ │ │ │ ├── app.css │ │ │ │ └── app.js │ │ │ ├── index.html │ │ │ └── lib │ │ │ │ ├── angular2.dev.js │ │ │ │ └── system.src.js │ │ └── server │ │ │ └── app.js │ ├── gulpfile.js │ ├── gulpfile.ts │ ├── package.json │ ├── readme.md │ ├── src │ │ ├── client │ │ │ ├── app │ │ │ │ ├── app.scss │ │ │ │ └── app.ts │ │ │ ├── index.html │ │ │ └── tsconfig.json │ │ └── server │ │ │ ├── app.ts │ │ │ ├── tsconfig.json │ │ │ ├── tsd.json │ │ │ └── typings │ │ │ ├── express │ │ │ └── express.d.ts │ │ │ ├── mime │ │ │ └── mime.d.ts │ │ │ ├── node │ │ │ └── node.d.ts │ │ │ ├── serve-static │ │ │ └── serve-static.d.ts │ │ │ └── tsd.d.ts │ ├── test │ │ ├── server_Test.js │ │ ├── server_Test.ts │ │ └── tsconfig.json │ ├── tsconfig.json │ ├── tsd.json │ └── typings │ │ ├── chai │ │ └── chai.d.ts │ │ ├── gulp-mocha │ │ └── gulp-mocha.d.ts │ │ ├── gulp-nodemon │ │ └── gulp-nodemon.d.ts │ │ ├── gulp-sass │ │ └── gulp-sass.d.ts │ │ ├── gulp-typescript │ │ └── gulp-typescript.d.ts │ │ ├── gulp │ │ └── gulp.d.ts │ │ ├── mocha │ │ └── mocha.d.ts │ │ ├── node │ │ └── node.d.ts │ │ ├── orchestrator │ │ └── orchestrator.d.ts │ │ ├── q │ │ └── Q.d.ts │ │ ├── rimraf │ │ └── rimraf.d.ts │ │ ├── superagent │ │ └── superagent.d.ts │ │ ├── supertest │ │ └── supertest.d.ts │ │ └── tsd.d.ts ├── step2_middlewares │ ├── .gitignore │ ├── .vscode │ │ └── tasks.json │ ├── built │ │ └── server.js │ ├── gulpfile.js │ ├── package.json │ ├── public │ │ └── img │ │ │ └── typescript.png │ ├── readme.md │ ├── src │ │ ├── server.js │ │ └── server.ts │ ├── tsconfig.json │ ├── tsd.json │ ├── typings │ │ ├── body-parser │ │ │ └── body-parser.d.ts │ │ ├── express │ │ │ └── express.d.ts │ │ ├── mime │ │ │ └── mime.d.ts │ │ ├── node │ │ │ └── node.d.ts │ │ ├── serve-static │ │ │ └── serve-static.d.ts │ │ └── tsd.d.ts │ └── views │ │ └── index.ejs ├── step3_middlewares-multiple │ ├── .gitignore │ ├── .vscode │ │ └── tasks.json │ ├── built │ │ └── server.js │ ├── gulpfile.js │ ├── package.json │ ├── public │ │ └── img │ │ │ └── typescript.png │ ├── readme.md │ ├── src │ │ ├── server.js │ │ └── server.ts │ ├── tsconfig.json │ ├── tsd.json │ ├── typings │ │ ├── body-parser │ │ │ └── body-parser.d.ts │ │ ├── express │ │ │ └── express.d.ts │ │ ├── mime │ │ │ └── mime.d.ts │ │ ├── node │ │ │ └── node.d.ts │ │ ├── serve-static │ │ │ └── serve-static.d.ts │ │ └── tsd.d.ts │ └── views │ │ └── index.ejs ├── step4_middlewares-error-handling │ ├── .gitignore │ ├── .vscode │ │ └── tasks.json │ ├── built │ │ └── server.js │ ├── gulpfile.js │ ├── package.json │ ├── public │ │ └── img │ │ │ └── typescript.png │ ├── readme.md │ ├── src │ │ ├── server.js │ │ └── server.ts │ ├── tsconfig.json │ ├── tsd.json │ ├── typings │ │ ├── body-parser │ │ │ └── body-parser.d.ts │ │ ├── express │ │ │ └── express.d.ts │ │ ├── mime │ │ │ └── mime.d.ts │ │ ├── node │ │ │ └── node.d.ts │ │ ├── serve-static │ │ │ └── serve-static.d.ts │ │ └── tsd.d.ts │ └── views │ │ └── index.ejs ├── step5_middlewares-mounting │ ├── .gitignore │ ├── .vscode │ │ └── tasks.json │ ├── built │ │ └── server.js │ ├── gulpfile.js │ ├── package.json │ ├── public │ │ └── img │ │ │ └── typescript.png │ ├── readme.md │ ├── src │ │ ├── server.js │ │ └── server.ts │ ├── tsconfig.json │ ├── tsd.json │ ├── typings │ │ ├── body-parser │ │ │ └── body-parser.d.ts │ │ ├── express │ │ │ └── express.d.ts │ │ ├── mime │ │ │ └── mime.d.ts │ │ ├── node │ │ │ └── node.d.ts │ │ ├── serve-static │ │ │ └── serve-static.d.ts │ │ └── tsd.d.ts │ └── views │ │ └── index.ejs ├── step6_middlewares-routes │ ├── .gitignore │ ├── .vscode │ │ └── tasks.json │ ├── built │ │ └── server.js │ ├── gulpfile.js │ ├── package.json │ ├── public │ │ └── img │ │ │ └── typescript.png │ ├── readme.md │ ├── src │ │ ├── server.js │ │ └── server.ts │ ├── tsconfig.json │ ├── tsd.json │ ├── typings │ │ ├── body-parser │ │ │ └── body-parser.d.ts │ │ ├── express │ │ │ └── express.d.ts │ │ ├── mime │ │ │ └── mime.d.ts │ │ ├── node │ │ │ └── node.d.ts │ │ ├── serve-static │ │ │ └── serve-static.d.ts │ │ └── tsd.d.ts │ └── views │ │ └── index.ejs ├── step7_routing │ ├── .gitignore │ ├── built │ │ ├── routes │ │ │ ├── index.js │ │ │ └── second.js │ │ └── server.js │ ├── gulpfile.js │ ├── package.json │ ├── public │ │ └── img │ │ │ └── typescript.png │ ├── readme.md │ ├── src │ │ ├── routes │ │ │ ├── index.ts │ │ │ └── second.ts │ │ └── server.ts │ ├── tsconfig.json │ ├── tsd.json │ ├── typings │ │ ├── body-parser │ │ │ └── body-parser.d.ts │ │ ├── express │ │ │ └── express.d.ts │ │ ├── mime │ │ │ └── mime.d.ts │ │ ├── morgan │ │ │ └── morgan.d.ts │ │ ├── node │ │ │ └── node.d.ts │ │ ├── serve-static │ │ │ └── serve-static.d.ts │ │ └── tsd.d.ts │ └── views │ │ ├── index.ejs │ │ └── page2.ejs ├── step8_ejs │ ├── .gitignore │ ├── .vscode │ │ └── tasks.json │ ├── built │ │ └── server.js │ ├── gulpfile.js │ ├── package.json │ ├── public │ │ └── img │ │ │ └── typescript.png │ ├── readme.md │ ├── src │ │ └── server.ts │ ├── tsconfig.json │ ├── tsd.json │ ├── typings │ │ ├── body-parser │ │ │ └── body-parser.d.ts │ │ ├── express │ │ │ └── express.d.ts │ │ ├── mime │ │ │ └── mime.d.ts │ │ ├── morgan │ │ │ └── morgan.d.ts │ │ ├── node │ │ │ └── node.d.ts │ │ ├── serve-static │ │ │ └── serve-static.d.ts │ │ └── tsd.d.ts │ └── views │ │ ├── ejs-datafromserver.ejs │ │ ├── ejs.ejs │ │ └── partial.ejs ├── step9_querystring │ ├── .gitignore │ ├── .vscode │ │ └── tasks.json │ ├── built │ │ └── server.js │ ├── gulpfile.js │ ├── package.json │ ├── public │ │ └── img │ │ │ └── typescript.png │ ├── readme.md │ ├── src │ │ └── server.ts │ ├── tsconfig.json │ ├── tsd.json │ ├── typings │ │ ├── body-parser │ │ │ └── body-parser.d.ts │ │ ├── express │ │ │ └── express.d.ts │ │ ├── mime │ │ │ └── mime.d.ts │ │ ├── morgan │ │ │ └── morgan.d.ts │ │ ├── node │ │ │ └── node.d.ts │ │ ├── serve-static │ │ │ └── serve-static.d.ts │ │ └── tsd.d.ts │ └── views │ │ └── index.ejs ├── step_test_spa │ ├── .gitignore │ ├── client │ │ └── index.html │ ├── dist │ │ ├── client │ │ │ └── index.html │ │ └── server │ │ │ └── app.js │ ├── gulpfile.js │ ├── package.json │ ├── readme.md │ └── server │ │ ├── app.ts │ │ ├── tsconfig.json │ │ ├── tsd.json │ │ └── typings │ │ ├── express │ │ └── express.d.ts │ │ ├── mime │ │ └── mime.d.ts │ │ ├── node │ │ └── node.d.ts │ │ ├── serve-static │ │ └── serve-static.d.ts │ │ └── tsd.d.ts └── typed-express-in-action │ ├── .eslintrc │ ├── .nvmrc │ ├── Chapter_01 │ └── express_hello_world │ │ ├── .gitignore │ │ ├── .vscode │ │ └── tasks.json │ │ ├── app.js │ │ ├── app.ts │ │ ├── package.json │ │ ├── readme.md │ │ ├── tsconfig.json │ │ ├── tsd.json │ │ └── typings │ │ ├── express │ │ └── express.d.ts │ │ ├── mime │ │ └── mime.d.ts │ │ ├── node │ │ └── node.d.ts │ │ ├── serve-static │ │ └── serve-static.d.ts │ │ └── tsd.d.ts │ ├── Chapter_02 │ ├── built_in_modules │ │ ├── .vscode │ │ │ └── tasks.json │ │ ├── app.js │ │ ├── app.ts │ │ ├── package.json │ │ ├── readme.md │ │ ├── tsconfig.json │ │ ├── tsd.json │ │ └── typings │ │ │ ├── node │ │ │ └── node.d.ts │ │ │ └── tsd.d.ts │ ├── defining_modules_es2015 │ │ ├── .vscode │ │ │ └── tasks.json │ │ ├── app.js │ │ ├── app.ts │ │ ├── package.json │ │ ├── random-integer.js │ │ ├── random-integer.ts │ │ ├── readme.md │ │ ├── tsconfig.json │ │ ├── tsd.json │ │ └── typings │ │ │ ├── node │ │ │ └── node.d.ts │ │ │ └── tsd.d.ts │ ├── node_hello_world │ │ ├── .vscode │ │ │ └── tasks.json │ │ ├── app.js │ │ ├── app.ts │ │ ├── package.json │ │ ├── readme.md │ │ ├── tsconfig.json │ │ ├── tsd.json │ │ └── typings │ │ │ ├── node │ │ │ └── node.d.ts │ │ │ └── tsd.d.ts │ ├── node_webserver │ │ ├── .vscode │ │ │ └── tasks.json │ │ ├── app.js │ │ ├── app.ts │ │ ├── package.json │ │ ├── readme.md │ │ ├── tsconfig.json │ │ ├── tsd.json │ │ └── typings │ │ │ ├── node │ │ │ └── node.d.ts │ │ │ └── tsd.d.ts │ ├── node_webserver_routing │ │ ├── .vscode │ │ │ └── tasks.json │ │ ├── app.js │ │ ├── app.ts │ │ ├── package.json │ │ ├── readme.md │ │ ├── tsconfig.json │ │ ├── tsd.json │ │ └── typings │ │ │ ├── node │ │ │ └── node.d.ts │ │ │ └── tsd.d.ts │ ├── reading_file_async │ │ ├── .vscode │ │ │ └── tasks.json │ │ ├── app.js │ │ ├── app.ts │ │ ├── myfile.txt │ │ ├── package.json │ │ ├── readme.md │ │ ├── tsconfig.json │ │ ├── tsd.json │ │ └── typings │ │ │ ├── node │ │ │ └── node.d.ts │ │ │ └── tsd.d.ts │ └── third_party_modules │ │ ├── .vscode │ │ └── tasks.json │ │ ├── app.js │ │ ├── app.ts │ │ ├── package.json │ │ ├── readme.md │ │ ├── tsconfig.json │ │ ├── tsd.json │ │ └── typings │ │ ├── mustache │ │ └── mustache.d.ts │ │ ├── node │ │ └── node.d.ts │ │ └── tsd.d.ts │ ├── Chapter_03 │ ├── guestbook │ │ ├── .gitignore │ │ ├── .vscode │ │ │ └── tasks.json │ │ ├── app.js │ │ ├── app.ts │ │ ├── converter.js │ │ ├── converter.ts │ │ ├── index.html │ │ ├── package.json │ │ ├── readme.md │ │ ├── tsconfig.json │ │ ├── tsd.json │ │ ├── typings │ │ │ ├── body-parser │ │ │ │ └── body-parser.d.ts │ │ │ ├── express │ │ │ │ └── express.d.ts │ │ │ ├── mime │ │ │ │ └── mime.d.ts │ │ │ ├── morgan │ │ │ │ └── morgan.d.ts │ │ │ ├── node │ │ │ │ └── node.d.ts │ │ │ ├── serve-static │ │ │ │ └── serve-static.d.ts │ │ │ └── tsd.d.ts │ │ └── views │ │ │ ├── 404.ejs │ │ │ ├── footer.ejs │ │ │ ├── header.ejs │ │ │ ├── index.ejs │ │ │ └── new-entry.ejs │ ├── hello-world │ │ ├── .gitignore │ │ ├── .vscode │ │ │ └── tasks.json │ │ ├── app-simple.js │ │ ├── app-simple.ts │ │ ├── app.js │ │ ├── app.ts │ │ ├── cool-facts.txt │ │ ├── package.json │ │ ├── readme.md │ │ ├── route-example.js │ │ ├── route-example.ts │ │ ├── tsconfig.json │ │ ├── tsd.json │ │ └── typings │ │ │ ├── express │ │ │ └── express.d.ts │ │ │ ├── mime │ │ │ └── mime.d.ts │ │ │ ├── morgan │ │ │ └── morgan.d.ts │ │ │ ├── node │ │ │ └── node.d.ts │ │ │ ├── serve-static │ │ │ └── serve-static.d.ts │ │ │ └── tsd.d.ts │ ├── routing │ │ ├── .gitignore │ │ ├── .vscode │ │ │ └── tasks.json │ │ ├── app.js │ │ ├── app.ts │ │ ├── package.json │ │ ├── public │ │ │ └── file.txt │ │ ├── readme.md │ │ ├── tsconfig.json │ │ ├── tsd.json │ │ └── typings │ │ │ ├── express │ │ │ └── express.d.ts │ │ │ ├── mime │ │ │ └── mime.d.ts │ │ │ ├── node │ │ │ └── node.d.ts │ │ │ ├── serve-static │ │ │ └── serve-static.d.ts │ │ │ └── tsd.d.ts │ ├── statics │ │ ├── .gitignore │ │ ├── .vscode │ │ │ └── tasks.json │ │ ├── app.js │ │ ├── app.ts │ │ ├── package.json │ │ ├── public │ │ │ └── file.txt │ │ ├── readme.md │ │ ├── tsconfig.json │ │ ├── tsd.json │ │ └── typings │ │ │ ├── express │ │ │ └── express.d.ts │ │ │ ├── mime │ │ │ └── mime.d.ts │ │ │ ├── node │ │ │ └── node.d.ts │ │ │ ├── serve-static │ │ │ └── serve-static.d.ts │ │ │ └── tsd.d.ts │ └── views-example │ │ ├── .gitignore │ │ ├── .vscode │ │ └── tasks.json │ │ ├── app.js │ │ ├── app.ts │ │ ├── package.json │ │ ├── readme.md │ │ ├── tsconfig.json │ │ ├── tsd.json │ │ ├── typings │ │ ├── express │ │ │ └── express.d.ts │ │ ├── mime │ │ │ └── mime.d.ts │ │ ├── node │ │ │ └── node.d.ts │ │ ├── serve-static │ │ │ └── serve-static.d.ts │ │ └── tsd.d.ts │ │ └── views │ │ └── index.ejs │ ├── Chapter_04 │ ├── error-stack │ │ ├── .gitignore │ │ ├── .vscode │ │ │ └── tasks.json │ │ ├── app.js │ │ ├── app.ts │ │ ├── package.json │ │ ├── tsconfig.json │ │ ├── tsd.json │ │ └── typings │ │ │ ├── express │ │ │ └── express.d.ts │ │ │ ├── mime │ │ │ └── mime.d.ts │ │ │ ├── morgan │ │ │ └── morgan.d.ts │ │ │ ├── node │ │ │ └── node.d.ts │ │ │ ├── serve-static │ │ │ └── serve-static.d.ts │ │ │ └── tsd.d.ts │ └── static-file-fun │ │ ├── .gitignore │ │ ├── .vscode │ │ └── tasks.json │ │ ├── app.js │ │ ├── app.ts │ │ ├── first-version.js │ │ ├── first-version.ts │ │ ├── package.json │ │ ├── static │ │ └── hello.txt │ │ ├── tsconfig.json │ │ ├── tsd.json │ │ └── typings │ │ ├── express │ │ └── express.d.ts │ │ ├── mime │ │ └── mime.d.ts │ │ ├── morgan │ │ └── morgan.d.ts │ │ ├── node │ │ └── node.d.ts │ │ ├── serve-static │ │ └── serve-static.d.ts │ │ └── tsd.d.ts │ ├── Chapter_05 │ └── temperature-by-zip-code │ │ ├── .gitignore │ │ ├── .vscode │ │ └── tasks.json │ │ ├── app.js │ │ ├── app.ts │ │ ├── package.json │ │ ├── public │ │ ├── the.css │ │ ├── the.js │ │ └── the.ts │ │ ├── tsconfig.json │ │ ├── tsd.json │ │ ├── typings │ │ ├── express │ │ │ └── express.d.ts │ │ ├── jquery │ │ │ └── jquery.d.ts │ │ ├── mime │ │ │ └── mime.d.ts │ │ ├── morgan │ │ │ └── morgan.d.ts │ │ ├── node │ │ │ └── node.d.ts │ │ ├── serve-static │ │ │ └── serve-static.d.ts │ │ └── tsd.d.ts │ │ └── views │ │ ├── 404.ejs │ │ ├── footer.ejs │ │ ├── header.ejs │ │ └── index.ejs │ ├── Chapter_06 │ └── random-number-api │ │ ├── .gitignore │ │ ├── .vscode │ │ └── tasks.json │ │ ├── app.js │ │ ├── app.ts │ │ ├── package.json │ │ ├── tsconfig.json │ │ ├── tsd.json │ │ └── typings │ │ ├── express │ │ └── express.d.ts │ │ ├── jquery │ │ └── jquery.d.ts │ │ ├── mime │ │ └── mime.d.ts │ │ ├── morgan │ │ └── morgan.d.ts │ │ ├── node │ │ └── node.d.ts │ │ ├── serve-static │ │ └── serve-static.d.ts │ │ └── tsd.d.ts │ ├── Chapter_08 │ └── learn-about-me │ │ ├── .gitignore │ │ ├── .vscode │ │ └── tasks.json │ │ ├── app.js │ │ ├── app.ts │ │ ├── models │ │ ├── user.js │ │ └── user.ts │ │ ├── npm-debug.log │ │ ├── package.json │ │ ├── random-number-api │ │ ├── .gitignore │ │ ├── .vscode │ │ │ └── tasks.json │ │ ├── app.js │ │ ├── app.ts │ │ ├── package.json │ │ ├── tsconfig.json │ │ ├── tsd.json │ │ └── typings │ │ │ ├── express │ │ │ └── express.d.ts │ │ │ ├── jquery │ │ │ └── jquery.d.ts │ │ │ ├── mime │ │ │ └── mime.d.ts │ │ │ ├── morgan │ │ │ └── morgan.d.ts │ │ │ ├── node │ │ │ └── node.d.ts │ │ │ ├── serve-static │ │ │ └── serve-static.d.ts │ │ │ └── tsd.d.ts │ │ ├── routes.js │ │ ├── routes.ts │ │ ├── setuppassport.js │ │ ├── setuppassport.ts │ │ ├── tsconfig.json │ │ ├── tsd.json │ │ ├── typings │ │ ├── body-parser │ │ │ └── body-parser.d.ts │ │ ├── connect-flash │ │ │ └── connect-flash.d.ts │ │ ├── cookie-parser │ │ │ └── cookie-parser.d.ts │ │ ├── express-session │ │ │ └── express-session.d.ts │ │ ├── express │ │ │ └── express.d.ts │ │ ├── jquery │ │ │ └── jquery.d.ts │ │ ├── mime │ │ │ └── mime.d.ts │ │ ├── mongoose │ │ │ └── mongoose.d.ts │ │ ├── morgan │ │ │ └── morgan.d.ts │ │ ├── node │ │ │ └── node.d.ts │ │ ├── passport-local │ │ │ └── passport-local.d.ts │ │ ├── passport │ │ │ └── passport.d.ts │ │ ├── serve-static │ │ │ └── serve-static.d.ts │ │ └── tsd.d.ts │ │ └── views │ │ ├── _footer.ejs │ │ ├── _header.ejs │ │ ├── edit.ejs │ │ ├── index.ejs │ │ ├── login.ejs │ │ ├── profile.ejs │ │ └── signup.ejs │ ├── Chapter_09 │ ├── simple_tests │ │ ├── .gitignore │ │ ├── capitalize.js │ │ ├── package.json │ │ └── test │ │ │ ├── capitalize.js │ │ │ └── mocha.opts │ └── whats_my_useragent │ │ ├── .gitignore │ │ ├── app.js │ │ ├── package.json │ │ ├── test │ │ ├── html.js │ │ └── txt.js │ │ └── views │ │ └── index.ejs │ ├── Chapter_10 │ ├── csrf-example │ │ ├── app.js │ │ ├── package.json │ │ └── views │ │ │ └── index.ejs │ ├── forever-example │ │ ├── app.js │ │ └── package.json │ └── print-queries │ │ ├── app.js │ │ └── package.json │ ├── Chapter_11 │ ├── grunt-examples │ │ ├── .gitignore │ │ ├── Gruntfile.js │ │ ├── app.js │ │ ├── my_css │ │ │ └── main.less │ │ ├── my_javascripts │ │ │ └── main.js │ │ └── package.json │ └── heroku-app │ │ ├── .gitignore │ │ ├── Procfile │ │ ├── app.js │ │ └── package.json │ ├── Chapter_12 │ └── express-generated-app │ │ ├── .gitignore │ │ ├── app.js │ │ ├── bin │ │ └── www │ │ ├── package.json │ │ ├── public │ │ └── stylesheets │ │ │ └── style.css │ │ ├── routes │ │ ├── index.js │ │ └── users.js │ │ └── views │ │ ├── error.jade │ │ ├── index.jade │ │ └── layout.jade │ ├── README.md │ └── Vagrantfile ├── step00_helloworld ├── app.js ├── app.ts ├── package.json └── readme.md ├── step01_chapter01_what_is_express └── express_hello_world │ ├── .gitignore │ ├── app.js │ ├── app.ts │ ├── package-lock.json │ ├── package.json │ ├── readme.md │ └── tsconfig.json ├── step02_chapter02_the_basics_of_node.js ├── built_in_modules │ ├── app.js │ ├── app.ts │ ├── package-lock.json │ ├── package.json │ ├── readme.md │ └── tsconfig.json ├── defining_modules_es2015 │ ├── app.js │ ├── app.ts │ ├── my-module.js │ ├── my-module.ts │ ├── package.json │ ├── readme.md │ └── tsconfig.json ├── node_hello_world │ ├── app.js │ ├── app.ts │ ├── package.json │ ├── readme.md │ └── tsconfig.json ├── node_webserver │ ├── app.js │ ├── app.ts │ ├── package-lock.json │ ├── package.json │ ├── readme.md │ └── tsconfig.json ├── node_webserver_routing │ ├── app.js │ ├── app.ts │ ├── package-lock.json │ ├── package.json │ ├── readme.md │ └── tsconfig.json ├── reading_file_async │ ├── app.js │ ├── app.ts │ ├── myfile.txt │ ├── package-lock.json │ ├── package.json │ ├── readme.md │ └── tsconfig.json └── third_party_modules │ ├── app.js │ ├── app.ts │ ├── package-lock.json │ ├── package.json │ ├── readme.md │ └── tsconfig.json ├── step03_chapter03_foundations_of_express ├── guestbook │ ├── .gitignore │ ├── app.js │ ├── app.ts │ ├── index.html │ ├── package-lock.json │ ├── package.json │ ├── readme.md │ ├── tsconfig.json │ └── views │ │ ├── 404.ejs │ │ ├── footer.ejs │ │ ├── header.ejs │ │ ├── index.ejs │ │ └── new-entry.ejs ├── hello-world │ ├── .gitignore │ ├── app-simple.js │ ├── app-simple.ts │ ├── app.js │ ├── app.ts │ ├── cool-facts.txt │ ├── package.json │ ├── readme.md │ ├── route-example.js │ ├── route-example.ts │ └── tsconfig.json ├── routing │ ├── .gitignore │ ├── app.js │ ├── app.ts │ ├── package.json │ ├── public │ │ └── file.txt │ ├── readme.md │ └── tsconfig.json ├── statics │ ├── .gitignore │ ├── app.js │ ├── app.ts │ ├── package.json │ ├── public │ │ └── file.txt │ ├── readme.md │ └── tsconfig.json └── views-example │ ├── .gitignore │ ├── app.js │ ├── app.ts │ ├── package.json │ ├── readme.md │ ├── tsconfig.json │ └── views │ └── index.ejs ├── step04_chapter04_middleware ├── error-stack │ ├── .gitignore │ ├── app.js │ ├── app.ts │ ├── package.json │ └── tsconfig.json └── static-file-fun │ ├── .gitignore │ ├── app.js │ ├── app.ts │ ├── first-version.js │ ├── first-version.ts │ ├── package.json │ ├── static │ └── hello.txt │ └── tsconfig.json ├── step05_chapter05_routing └── temperature-by-zip-code │ ├── .gitignore │ ├── app.js │ ├── app.ts │ ├── package.json │ ├── public │ ├── the.css │ ├── the.js │ └── the.ts │ ├── tsconfig.json │ └── views │ ├── 404.ejs │ ├── footer.ejs │ ├── header.ejs │ └── index.ejs ├── step06_chapter06_building_APIs └── random-number-api │ ├── .gitignore │ ├── app.js │ ├── app.ts │ ├── package.json │ └── tsconfig.json ├── step07_views_ejs ├── .gitignore ├── app.js ├── app.ts ├── package.json ├── public │ └── img │ │ └── typescript.png ├── readme.md ├── tsconfig.json └── views │ ├── ejs-datafromserver.ejs │ ├── ejs.ejs │ └── partial.ejs ├── step08_chapter08_MongoDB ├── learn-about-me │ ├── .gitignore │ ├── app.js │ ├── app.ts │ ├── models │ │ ├── user.js │ │ └── user.ts │ ├── npm-debug.log │ ├── package.json │ ├── random-number-api │ │ ├── .gitignore │ │ ├── app.js │ │ ├── app.ts │ │ ├── package.json │ │ └── tsconfig.json │ ├── routes.js │ ├── routes.ts │ ├── setuppassport.js │ ├── setuppassport.ts │ ├── tsconfig.json │ └── views │ │ ├── _footer.ejs │ │ ├── _header.ejs │ │ ├── edit.ejs │ │ ├── index.ejs │ │ ├── login.ejs │ │ ├── profile.ejs │ │ └── signup.ejs └── typed_mongoose │ ├── basic │ ├── .gitignore │ ├── IUserModel.js │ ├── IUserModel.ts │ ├── User.js │ ├── User.ts │ ├── app.js │ ├── app.ts │ ├── package.json │ ├── readme.md │ ├── shared │ │ ├── IUser.js │ │ └── IUser.ts │ └── tsconfig.json │ ├── basic2 │ ├── .gitignore │ ├── app.js │ ├── app.ts │ ├── package.json │ ├── readme.md │ └── tsconfig.json │ ├── basic3 │ ├── .gitignore │ ├── IProjectModel.js │ ├── IProjectModel.ts │ ├── IUserModel.js │ ├── IUserModel.ts │ ├── Project.js │ ├── Project.ts │ ├── User.js │ ├── User.ts │ ├── app.js │ ├── app.ts │ ├── package.json │ ├── readme.md │ ├── shared │ │ ├── IProject.js │ │ ├── IProject.ts │ │ ├── IUser.js │ │ └── IUser.ts │ └── tsconfig.json │ └── basic4 │ ├── .gitignore │ ├── IProjectModel.js │ ├── IProjectModel.ts │ ├── IUserModel.js │ ├── IUserModel.ts │ ├── Project.js │ ├── Project.ts │ ├── User.js │ ├── User.ts │ ├── app.js │ ├── app.ts │ ├── package.json │ ├── readme.md │ ├── shared │ ├── IProject.js │ ├── IProject.ts │ ├── IUser.js │ └── IUser.ts │ └── tsconfig.json ├── step09_chapter09_Testing Express Applications ├── simple_tests │ ├── .gitignore │ ├── capitalize.js │ ├── package.json │ └── test │ │ ├── capitalize.js │ │ └── mocha.opts └── whats_my_useragent │ ├── .gitignore │ ├── app.js │ ├── package.json │ ├── test │ ├── html.js │ └── txt.js │ └── views │ └── index.ejs ├── step10_chapter10_security ├── csrf-example │ ├── app.js │ ├── package.json │ └── views │ │ └── index.ejs ├── forever-example │ ├── app.js │ └── package.json └── print-queries │ ├── app.js │ └── package.json ├── step11_chapter11_Deployment Assets & Heroku ├── grunt-examples │ ├── .gitignore │ ├── Gruntfile.js │ ├── app.js │ ├── my_css │ │ └── main.less │ ├── my_javascripts │ │ └── main.js │ └── package.json └── heroku-app │ ├── .gitignore │ ├── Procfile │ ├── app.js │ └── package.json └── step12_chapter12 └── express-generated-app ├── .gitignore ├── app.js ├── bin └── www ├── package.json ├── public └── stylesheets │ └── style.css ├── routes ├── index.js └── users.js └── views ├── error.jade ├── index.jade └── layout.jade /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /_old/step0_hello_express/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /_old/step0_hello_express/readme.md: -------------------------------------------------------------------------------- 1 | Read: 2 | http://www.waltza.com/2015/07/22/new-family-express-4-angular-2-gulp-and-typescript/ 3 | 4 | https://code.visualstudio.com/Docs/runtimes/nodejs -------------------------------------------------------------------------------- /_old/step0_hello_express/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /_old/step0_hello_express/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | -------------------------------------------------------------------------------- /_old/step0_hello_express/views/index.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Express using Typescript 6 | 7 | 8 | 9 | 10 |

Hello Express using TypeScript

11 | 12 | 13 | -------------------------------------------------------------------------------- /_old/step10_url-parameters/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /_old/step10_url-parameters/public/img/typescript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/panacloud/learn-typed-express/abae539066747ea9a5afdd34ed137443ea1cb4cd/_old/step10_url-parameters/public/img/typescript.png -------------------------------------------------------------------------------- /_old/step10_url-parameters/readme.md: -------------------------------------------------------------------------------- 1 | # req.params: 2 | An object containing properties mapped to the named route “parameters”. For example, if you have the route /user/:name, then the “name” property is available as req.params.name. This object defaults to {}. 3 | 4 | // GET /user/tj 5 | req.params.name 6 | // => "tj" -------------------------------------------------------------------------------- /_old/step10_url-parameters/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /_old/step10_url-parameters/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | /// 6 | /// 7 | -------------------------------------------------------------------------------- /_old/step10_url-parameters/views/index.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /_old/step11_post-bodyparser/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /_old/step11_post-bodyparser/public/img/typescript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/panacloud/learn-typed-express/abae539066747ea9a5afdd34ed137443ea1cb4cd/_old/step11_post-bodyparser/public/img/typescript.png -------------------------------------------------------------------------------- /_old/step11_post-bodyparser/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /_old/step11_post-bodyparser/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | /// 6 | /// 7 | -------------------------------------------------------------------------------- /_old/step12_express-session/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /_old/step12_express-session/public/img/typescript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/panacloud/learn-typed-express/abae539066747ea9a5afdd34ed137443ea1cb4cd/_old/step12_express-session/public/img/typescript.png -------------------------------------------------------------------------------- /_old/step12_express-session/readme.md: -------------------------------------------------------------------------------- 1 | # express-session 2 | Simple session middleware for Express 3 | 4 | Installation 5 | - npm install express-session --save 6 | - tsd install express-session --save 7 | 8 | Example 9 | 10 | app.use(session({ 11 | genid: function(req) { 12 | return genuuid() // use UUIDs for session IDs 13 | }, 14 | secret: 'any secret string' 15 | })) 16 | 17 | app.get("/", function(req, res){ 18 | res.send(req.session); 19 | }) -------------------------------------------------------------------------------- /_old/step12_express-session/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /_old/step12_express-session/typings/custom.d.ts: -------------------------------------------------------------------------------- 1 | declare module Express { 2 | export interface Session { 3 | user : { name : string, email : string }; 4 | } 5 | } -------------------------------------------------------------------------------- /_old/step12_express-session/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | /// 6 | /// 7 | /// 8 | /// -------------------------------------------------------------------------------- /_old/step13_rest-api/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /_old/step13_rest-api/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.1.0", 3 | "command": "gulp", 4 | "isShellCommand": true, 5 | "args": [ 6 | "--no-color" 7 | ], 8 | "tasks": [ 9 | { 10 | "taskName": "buildServer", 11 | "args": [], 12 | "isBuildCommand": true, 13 | "isWatching": false, 14 | "problemMatcher": [ 15 | "$lessCompile", 16 | "$tsc", 17 | "$jshint" 18 | ] 19 | } 20 | ] 21 | } -------------------------------------------------------------------------------- /_old/step13_rest-api/public/img/typescript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/panacloud/learn-typed-express/abae539066747ea9a5afdd34ed137443ea1cb4cd/_old/step13_rest-api/public/img/typescript.png -------------------------------------------------------------------------------- /_old/step13_rest-api/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /_old/step13_rest-api/typings/custom.d.ts: -------------------------------------------------------------------------------- 1 | declare module Express { 2 | export interface Session { 3 | user : { name : string, email : string }; 4 | } 5 | } -------------------------------------------------------------------------------- /_old/step13_rest-api/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | /// 6 | /// 7 | /// 8 | /// -------------------------------------------------------------------------------- /_old/step13_rest-api/views/index.ejs: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /_old/step14_mongodb-insert/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /_old/step14_mongodb-insert/public/img/typescript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/panacloud/learn-typed-express/abae539066747ea9a5afdd34ed137443ea1cb4cd/_old/step14_mongodb-insert/public/img/typescript.png -------------------------------------------------------------------------------- /_old/step14_mongodb-insert/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /_old/step14_mongodb-insert/typings/custom.d.ts: -------------------------------------------------------------------------------- 1 | declare module Express { 2 | export interface Session { 3 | user : { name : string, email : string }; 4 | } 5 | } -------------------------------------------------------------------------------- /_old/step14_mongodb-insert/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | /// 6 | /// 7 | /// 8 | /// 9 | -------------------------------------------------------------------------------- /_old/step14_mongodb-insert/views/index.ejs: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /_old/step15_mongodb-find/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /_old/step15_mongodb-find/public/img/typescript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/panacloud/learn-typed-express/abae539066747ea9a5afdd34ed137443ea1cb4cd/_old/step15_mongodb-find/public/img/typescript.png -------------------------------------------------------------------------------- /_old/step15_mongodb-find/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /_old/step15_mongodb-find/typings/custom.d.ts: -------------------------------------------------------------------------------- 1 | declare module Express { 2 | export interface Session { 3 | user : { name : string, email : string }; 4 | } 5 | } -------------------------------------------------------------------------------- /_old/step15_mongodb-find/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | /// 6 | /// 7 | /// 8 | /// 9 | -------------------------------------------------------------------------------- /_old/step15_mongodb-find/views/index.ejs: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /_old/step16_mongodb-remove/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /_old/step16_mongodb-remove/public/img/typescript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/panacloud/learn-typed-express/abae539066747ea9a5afdd34ed137443ea1cb4cd/_old/step16_mongodb-remove/public/img/typescript.png -------------------------------------------------------------------------------- /_old/step16_mongodb-remove/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /_old/step16_mongodb-remove/typings/custom.d.ts: -------------------------------------------------------------------------------- 1 | declare module Express { 2 | export interface Session { 3 | user : { name : string, email : string }; 4 | } 5 | } -------------------------------------------------------------------------------- /_old/step16_mongodb-remove/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | /// 6 | /// 7 | /// 8 | /// 9 | -------------------------------------------------------------------------------- /_old/step16_mongodb-remove/views/index.ejs: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /_old/step17_mongodb-update/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /_old/step17_mongodb-update/public/img/typescript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/panacloud/learn-typed-express/abae539066747ea9a5afdd34ed137443ea1cb4cd/_old/step17_mongodb-update/public/img/typescript.png -------------------------------------------------------------------------------- /_old/step17_mongodb-update/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /_old/step17_mongodb-update/typings/custom.d.ts: -------------------------------------------------------------------------------- 1 | declare module Express { 2 | export interface Session { 3 | user : { name : string, email : string }; 4 | } 5 | } -------------------------------------------------------------------------------- /_old/step17_mongodb-update/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | /// 6 | /// 7 | /// 8 | /// 9 | -------------------------------------------------------------------------------- /_old/step17_mongodb-update/views/index.ejs: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /_old/step18_mongodb/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | bower_components 3 | -------------------------------------------------------------------------------- /_old/step18_mongodb/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "step4_bootstrap", 3 | "version": "0.0.0", 4 | "homepage": "https://github.com/ziaukhan/learn-node-typescript", 5 | "authors": [ 6 | "Zia Khan " 7 | ], 8 | "moduleType": [ 9 | "amd", 10 | "node" 11 | ], 12 | "license": "MIT", 13 | "ignore": [ 14 | "**/.*", 15 | "node_modules", 16 | "bower_components", 17 | "test", 18 | "tests" 19 | ], 20 | "dependencies": { 21 | "bootstrap-sass": "~3.3.5" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /_old/step18_mongodb/built/db.js: -------------------------------------------------------------------------------- 1 | /// 2 | var mongoose = require('mongoose'); 3 | mongoose.connect('mongodb://localhost/test'); 4 | exports["default"] = mongoose; 5 | -------------------------------------------------------------------------------- /_old/step18_mongodb/built/models/IUser.js: -------------------------------------------------------------------------------- 1 | // http://stackoverflow.com/questions/30270084/why-the-limitation-on-exporting-an-interface-by-default-in-typescript 2 | -------------------------------------------------------------------------------- /_old/step18_mongodb/built/models/User.js: -------------------------------------------------------------------------------- 1 | //import mongoose = require("mongoose"); 2 | var db_1 = require('../db'); 3 | var userSchema = new db_1["default"].Schema({ 4 | email: String, 5 | password: String, 6 | displayName: String 7 | }); 8 | exports.User = db_1["default"].model("User", userSchema); 9 | -------------------------------------------------------------------------------- /_old/step18_mongodb/built/routes/createUserForm.js: -------------------------------------------------------------------------------- 1 | /// 2 | var express = require('express'); 3 | var router = express.Router(); 4 | /* GET new User */ 5 | router.get('/', function (req, res, next) { 6 | res.render('createUserForm'); 7 | }); 8 | module.exports = router; 9 | -------------------------------------------------------------------------------- /_old/step18_mongodb/built/routes/index.js: -------------------------------------------------------------------------------- 1 | /// 2 | var express = require('express'); 3 | var router = express.Router(); 4 | /* GET home page. */ 5 | router.get('/', function (req, res, next) { 6 | res.render('index', { title: 'Multi-page Express app using Typescript and Bootstrap' }); 7 | }); 8 | module.exports = router; 9 | -------------------------------------------------------------------------------- /_old/step18_mongodb/public/img/typescript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/panacloud/learn-typed-express/abae539066747ea9a5afdd34ed137443ea1cb4cd/_old/step18_mongodb/public/img/typescript.png -------------------------------------------------------------------------------- /_old/step18_mongodb/readme.md: -------------------------------------------------------------------------------- 1 | Read: 2 | https://github.com/Appsilon/styleguide/wiki/mongoose-typescript-models 3 | https://gist.github.com/masahirompp/3c012c8721b70821fa45 4 | https://gist.github.com/masahirompp/6cfdfd1e007187e61310 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /_old/step18_mongodb/sass/globals/variables.scss: -------------------------------------------------------------------------------- 1 | $font-size-base: 20px; -------------------------------------------------------------------------------- /_old/step18_mongodb/sass/main.scss: -------------------------------------------------------------------------------- 1 | // inject:global 2 | // endinject 3 | 4 | 5 | // bower:scss 6 | // endbower 7 | 8 | 9 | // inject:app 10 | // endinject -------------------------------------------------------------------------------- /_old/step18_mongodb/sass/mystyles/body.scss: -------------------------------------------------------------------------------- 1 | $primary-color: red; 2 | body { 3 | background-color: $primary-color; 4 | } 5 | -------------------------------------------------------------------------------- /_old/step18_mongodb/sass/mystyles/extend.scss: -------------------------------------------------------------------------------- 1 | .main-area { 2 | @extend .row; 3 | } 4 | .column { 5 | @extend .col-md-4; 6 | } 7 | .content { 8 | @extend .col-xs-6; 9 | @extend .col-sm-6; 10 | } 11 | .sidebar { 12 | @extend .col-xs-4; 13 | @extend .col-sm-4; 14 | } 15 | .side-nav { 16 | @extend .col-sm-2; 17 | @extend .col-sm-2; 18 | } -------------------------------------------------------------------------------- /_old/step18_mongodb/sass/mystyles/panel.scss: -------------------------------------------------------------------------------- 1 | .panel { 2 | color: $primary-color; 3 | } 4 | 5 | -------------------------------------------------------------------------------- /_old/step18_mongodb/src/db.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import mongoose = require('mongoose'); 4 | mongoose.connect('mongodb://localhost/test'); 5 | export default mongoose; -------------------------------------------------------------------------------- /_old/step18_mongodb/src/models/IUser.ts: -------------------------------------------------------------------------------- 1 | // http://stackoverflow.com/questions/30270084/why-the-limitation-on-exporting-an-interface-by-default-in-typescript 2 | 3 | interface IUser { 4 | email: string; 5 | password: string; 6 | displayName: string; 7 | } 8 | 9 | export default IUser; 10 | -------------------------------------------------------------------------------- /_old/step18_mongodb/src/models/User.ts: -------------------------------------------------------------------------------- 1 | //import mongoose = require("mongoose"); 2 | import mongoose from '../db'; 3 | 4 | //https://github.com/horiuchi/DefinitelyTyped/blob/master/mongoose/mongoose-tests.ts 5 | import IUser from 'IUser'; 6 | 7 | export interface IUserModel extends IUser, mongoose.Document { } 8 | 9 | var userSchema = new mongoose.Schema({ 10 | email: String, 11 | password: String, 12 | displayName: String 13 | }); 14 | 15 | 16 | export let User = mongoose.model("User", userSchema); 17 | 18 | 19 | -------------------------------------------------------------------------------- /_old/step18_mongodb/src/routes/createUserForm.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import express = require('express'); 4 | var router = express.Router(); 5 | import {IUserModel, User} from '../models/User'; 6 | 7 | /* GET new User */ 8 | router.get('/', function(req, res, next) { 9 | res.render('createUserForm'); 10 | }); 11 | 12 | 13 | 14 | export = router; -------------------------------------------------------------------------------- /_old/step18_mongodb/src/routes/index.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import express = require('express'); 4 | var router = express.Router(); 5 | 6 | /* GET home page. */ 7 | router.get('/', function(req, res, next) { 8 | res.render('index', { title: 'Multi-page Express app using Typescript and Bootstrap' }); 9 | }); 10 | 11 | export = router; -------------------------------------------------------------------------------- /_old/step18_mongodb/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /_old/step18_mongodb/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | /// 6 | /// 7 | /// 8 | /// 9 | /// 10 | -------------------------------------------------------------------------------- /_old/step19_sass/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /_old/step19_sass/built/routes/index.js: -------------------------------------------------------------------------------- 1 | /// 2 | var express = require('express'); 3 | var router = express.Router(); 4 | /* GET home page. */ 5 | router.get('/', function (req, res, next) { 6 | res.render('index', { title: 'Multi-page Express app using Typescript and SCSS' }); 7 | }); 8 | module.exports = router; 9 | -------------------------------------------------------------------------------- /_old/step19_sass/built/routes/second.js: -------------------------------------------------------------------------------- 1 | /// 2 | var express = require('express'); 3 | var router = express.Router(); 4 | /* GET second page. */ 5 | router.get('/', function (req, res, next) { 6 | res.render('page2', { titleData: 'This is the second page' }); 7 | }); 8 | module.exports = router; 9 | -------------------------------------------------------------------------------- /_old/step19_sass/public/css/mystyles.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: #eeffcc; } 3 | -------------------------------------------------------------------------------- /_old/step19_sass/public/img/typescript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/panacloud/learn-typed-express/abae539066747ea9a5afdd34ed137443ea1cb4cd/_old/step19_sass/public/img/typescript.png -------------------------------------------------------------------------------- /_old/step19_sass/readme.md: -------------------------------------------------------------------------------- 1 | Read: 2 | http://ryanchristiani.com/getting-started-with-gulp-and-sass/ 3 | 4 | To learn SCSS go to: 5 | https://scotch.io/tutorials/getting-started-with-sass 6 | 7 | Best way is to read this book: 8 | https://www.safaribooksonline.com/library/view/sass-essentials/9781782174301/ -------------------------------------------------------------------------------- /_old/step19_sass/sass/mystyles.scss: -------------------------------------------------------------------------------- 1 | $primaryColor: #eeffcc; 2 | 3 | body { 4 | background: $primaryColor; 5 | } 6 | -------------------------------------------------------------------------------- /_old/step19_sass/src/routes/index.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import express = require('express'); 4 | var router = express.Router(); 5 | 6 | /* GET home page. */ 7 | router.get('/', function(req, res, next) { 8 | res.render('index', { title: 'Multi-page Express app using Typescript and SCSS' }); 9 | }); 10 | 11 | export = router; -------------------------------------------------------------------------------- /_old/step19_sass/src/routes/second.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import express = require('express'); 4 | var router = express.Router(); 5 | 6 | /* GET second page. */ 7 | router.get('/', function(req, res, next) { 8 | res.render('page2', { titleData: 'This is the second page' }); 9 | }); 10 | 11 | export = router; -------------------------------------------------------------------------------- /_old/step19_sass/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /_old/step19_sass/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | /// 6 | /// 7 | -------------------------------------------------------------------------------- /_old/step19_sass/views/index.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Express using Typescript 6 | 7 | 8 | 9 | 10 |

<%= title %>

11 | some_text 12 | Go to second page 13 | 14 | -------------------------------------------------------------------------------- /_old/step19_sass/views/page2.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Express Page 2 using Typescript 6 | 7 | 8 | 9 | 10 |

<%= titleData %>

11 | Back to main page 12 | 13 | 14 | -------------------------------------------------------------------------------- /_old/step1_image/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /_old/step1_image/public/img/typescript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/panacloud/learn-typed-express/abae539066747ea9a5afdd34ed137443ea1cb4cd/_old/step1_image/public/img/typescript.png -------------------------------------------------------------------------------- /_old/step1_image/readme.md: -------------------------------------------------------------------------------- 1 | Follow: 2 | https://github.com/czechboy0/Express-4x-Typescript-Sample -------------------------------------------------------------------------------- /_old/step1_image/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /_old/step1_image/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | /// 6 | /// 7 | -------------------------------------------------------------------------------- /_old/step1_image/views/index.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Express using Typescript 6 | 7 | 8 | 9 | 10 |

Hello Express using TypeScript

11 | some_text 12 | 13 | 14 | -------------------------------------------------------------------------------- /_old/step20_bootstrap/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | bower_components 3 | -------------------------------------------------------------------------------- /_old/step20_bootstrap/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "step4_bootstrap", 3 | "version": "0.0.0", 4 | "homepage": "https://github.com/ziaukhan/learn-node-typescript", 5 | "authors": [ 6 | "Zia Khan " 7 | ], 8 | "moduleType": [ 9 | "amd", 10 | "node" 11 | ], 12 | "license": "MIT", 13 | "ignore": [ 14 | "**/.*", 15 | "node_modules", 16 | "bower_components", 17 | "test", 18 | "tests" 19 | ], 20 | "dependencies": { 21 | "bootstrap-sass": "~3.3.5" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /_old/step20_bootstrap/built/routes/index.js: -------------------------------------------------------------------------------- 1 | /// 2 | var express = require('express'); 3 | var router = express.Router(); 4 | /* GET home page. */ 5 | router.get('/', function (req, res, next) { 6 | res.render('index', { title: 'Multi-page Express app using Typescript and Bootstrap' }); 7 | }); 8 | module.exports = router; 9 | -------------------------------------------------------------------------------- /_old/step20_bootstrap/built/routes/second.js: -------------------------------------------------------------------------------- 1 | /// 2 | var express = require('express'); 3 | var router = express.Router(); 4 | /* GET second page. */ 5 | router.get('/', function (req, res, next) { 6 | res.render('page2', { titleData: 'This is the second page' }); 7 | }); 8 | module.exports = router; 9 | -------------------------------------------------------------------------------- /_old/step20_bootstrap/public/img/typescript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/panacloud/learn-typed-express/abae539066747ea9a5afdd34ed137443ea1cb4cd/_old/step20_bootstrap/public/img/typescript.png -------------------------------------------------------------------------------- /_old/step20_bootstrap/readme.md: -------------------------------------------------------------------------------- 1 | Read: 2 | http://david-barreto.com/working-with-sass-bootstrap-and-gulp/ -------------------------------------------------------------------------------- /_old/step20_bootstrap/sass/main.scss: -------------------------------------------------------------------------------- 1 | // bower:scss 2 | // endbower 3 | 4 | 5 | // inject:app 6 | // endinject -------------------------------------------------------------------------------- /_old/step20_bootstrap/sass/mystyles/body.scss: -------------------------------------------------------------------------------- 1 | $primary-color: red; 2 | body { 3 | background-color: $primary-color; 4 | } 5 | -------------------------------------------------------------------------------- /_old/step20_bootstrap/sass/mystyles/panel.scss: -------------------------------------------------------------------------------- 1 | .panel { 2 | color: $primary-color; 3 | } 4 | 5 | -------------------------------------------------------------------------------- /_old/step20_bootstrap/src/routes/index.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import express = require('express'); 4 | var router = express.Router(); 5 | 6 | /* GET home page. */ 7 | router.get('/', function(req, res, next) { 8 | res.render('index', { title: 'Multi-page Express app using Typescript and Bootstrap' }); 9 | }); 10 | 11 | export = router; -------------------------------------------------------------------------------- /_old/step20_bootstrap/src/routes/second.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import express = require('express'); 4 | var router = express.Router(); 5 | 6 | /* GET second page. */ 7 | router.get('/', function(req, res, next) { 8 | res.render('page2', { titleData: 'This is the second page' }); 9 | }); 10 | 11 | export = router; -------------------------------------------------------------------------------- /_old/step20_bootstrap/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /_old/step20_bootstrap/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | /// 6 | /// 7 | -------------------------------------------------------------------------------- /_old/step20_bootstrap/views/page2.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Express Page 2 using Typescript 6 | 7 | 8 | 9 | 10 |

<%= titleData %>

11 | Back to main page 12 | 13 | 14 | -------------------------------------------------------------------------------- /_old/step21_bootstrap_override/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | bower_components 3 | -------------------------------------------------------------------------------- /_old/step21_bootstrap_override/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "step4_bootstrap", 3 | "version": "0.0.0", 4 | "homepage": "https://github.com/ziaukhan/learn-node-typescript", 5 | "authors": [ 6 | "Zia Khan " 7 | ], 8 | "moduleType": [ 9 | "amd", 10 | "node" 11 | ], 12 | "license": "MIT", 13 | "ignore": [ 14 | "**/.*", 15 | "node_modules", 16 | "bower_components", 17 | "test", 18 | "tests" 19 | ], 20 | "dependencies": { 21 | "bootstrap-sass": "~3.3.5" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /_old/step21_bootstrap_override/built/routes/index.js: -------------------------------------------------------------------------------- 1 | /// 2 | var express = require('express'); 3 | var router = express.Router(); 4 | /* GET home page. */ 5 | router.get('/', function (req, res, next) { 6 | res.render('index', { title: 'Multi-page Express app using Typescript and Bootstrap' }); 7 | }); 8 | module.exports = router; 9 | -------------------------------------------------------------------------------- /_old/step21_bootstrap_override/built/routes/second.js: -------------------------------------------------------------------------------- 1 | /// 2 | var express = require('express'); 3 | var router = express.Router(); 4 | /* GET second page. */ 5 | router.get('/', function (req, res, next) { 6 | res.render('page2', { titleData: 'This is the second page' }); 7 | }); 8 | module.exports = router; 9 | -------------------------------------------------------------------------------- /_old/step21_bootstrap_override/public/img/typescript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/panacloud/learn-typed-express/abae539066747ea9a5afdd34ed137443ea1cb4cd/_old/step21_bootstrap_override/public/img/typescript.png -------------------------------------------------------------------------------- /_old/step21_bootstrap_override/readme.md: -------------------------------------------------------------------------------- 1 | Read: 2 | http://david-barreto.com/working-with-sass-bootstrap-and-gulp/ -------------------------------------------------------------------------------- /_old/step21_bootstrap_override/sass/globals/variables.scss: -------------------------------------------------------------------------------- 1 | $font-size-base: 20px; -------------------------------------------------------------------------------- /_old/step21_bootstrap_override/sass/main.scss: -------------------------------------------------------------------------------- 1 | // inject:global 2 | // endinject 3 | 4 | 5 | // bower:scss 6 | // endbower 7 | 8 | 9 | // inject:app 10 | // endinject -------------------------------------------------------------------------------- /_old/step21_bootstrap_override/sass/mystyles/body.scss: -------------------------------------------------------------------------------- 1 | $primary-color: red; 2 | body { 3 | background-color: $primary-color; 4 | } 5 | -------------------------------------------------------------------------------- /_old/step21_bootstrap_override/sass/mystyles/panel.scss: -------------------------------------------------------------------------------- 1 | .panel { 2 | color: $primary-color; 3 | } 4 | 5 | -------------------------------------------------------------------------------- /_old/step21_bootstrap_override/src/routes/index.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import express = require('express'); 4 | var router = express.Router(); 5 | 6 | /* GET home page. */ 7 | router.get('/', function(req, res, next) { 8 | res.render('index', { title: 'Multi-page Express app using Typescript and Bootstrap' }); 9 | }); 10 | 11 | export = router; -------------------------------------------------------------------------------- /_old/step21_bootstrap_override/src/routes/second.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import express = require('express'); 4 | var router = express.Router(); 5 | 6 | /* GET second page. */ 7 | router.get('/', function(req, res, next) { 8 | res.render('page2', { titleData: 'This is the second page' }); 9 | }); 10 | 11 | export = router; -------------------------------------------------------------------------------- /_old/step21_bootstrap_override/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /_old/step21_bootstrap_override/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | /// 6 | /// 7 | -------------------------------------------------------------------------------- /_old/step21_bootstrap_override/views/page2.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Express Page 2 using Typescript 6 | 7 | 8 | 9 | 10 |

<%= titleData %>

11 | Back to main page 12 | 13 | 14 | -------------------------------------------------------------------------------- /_old/step22_bootstrap_extend/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | bower_components 3 | -------------------------------------------------------------------------------- /_old/step22_bootstrap_extend/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "step4_bootstrap", 3 | "version": "0.0.0", 4 | "homepage": "https://github.com/ziaukhan/learn-node-typescript", 5 | "authors": [ 6 | "Zia Khan " 7 | ], 8 | "moduleType": [ 9 | "amd", 10 | "node" 11 | ], 12 | "license": "MIT", 13 | "ignore": [ 14 | "**/.*", 15 | "node_modules", 16 | "bower_components", 17 | "test", 18 | "tests" 19 | ], 20 | "dependencies": { 21 | "bootstrap-sass": "~3.3.5" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /_old/step22_bootstrap_extend/built/routes/index.js: -------------------------------------------------------------------------------- 1 | /// 2 | var express = require('express'); 3 | var router = express.Router(); 4 | /* GET home page. */ 5 | router.get('/', function (req, res, next) { 6 | res.render('index', { title: 'Multi-page Express app using Typescript and Bootstrap' }); 7 | }); 8 | module.exports = router; 9 | -------------------------------------------------------------------------------- /_old/step22_bootstrap_extend/built/routes/second.js: -------------------------------------------------------------------------------- 1 | /// 2 | var express = require('express'); 3 | var router = express.Router(); 4 | /* GET second page. */ 5 | router.get('/', function (req, res, next) { 6 | res.render('page2', { titleData: 'This is the second page' }); 7 | }); 8 | module.exports = router; 9 | -------------------------------------------------------------------------------- /_old/step22_bootstrap_extend/public/img/typescript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/panacloud/learn-typed-express/abae539066747ea9a5afdd34ed137443ea1cb4cd/_old/step22_bootstrap_extend/public/img/typescript.png -------------------------------------------------------------------------------- /_old/step22_bootstrap_extend/readme.md: -------------------------------------------------------------------------------- 1 | Read: 2 | http://www.hongkiat.com/blog/bootstrap-and-sass/ 3 | -------------------------------------------------------------------------------- /_old/step22_bootstrap_extend/sass/globals/variables.scss: -------------------------------------------------------------------------------- 1 | $font-size-base: 20px; -------------------------------------------------------------------------------- /_old/step22_bootstrap_extend/sass/main.scss: -------------------------------------------------------------------------------- 1 | // inject:global 2 | // endinject 3 | 4 | 5 | // bower:scss 6 | // endbower 7 | 8 | 9 | // inject:app 10 | // endinject -------------------------------------------------------------------------------- /_old/step22_bootstrap_extend/sass/mystyles/body.scss: -------------------------------------------------------------------------------- 1 | $primary-color: red; 2 | body { 3 | background-color: $primary-color; 4 | } 5 | -------------------------------------------------------------------------------- /_old/step22_bootstrap_extend/sass/mystyles/extend.scss: -------------------------------------------------------------------------------- 1 | .main-area { 2 | @extend .row; 3 | } 4 | .column { 5 | @extend .col-md-4; 6 | } 7 | .content { 8 | @extend .col-xs-6; 9 | @extend .col-sm-6; 10 | } 11 | .sidebar { 12 | @extend .col-xs-4; 13 | @extend .col-sm-4; 14 | } 15 | .side-nav { 16 | @extend .col-sm-2; 17 | @extend .col-sm-2; 18 | } -------------------------------------------------------------------------------- /_old/step22_bootstrap_extend/sass/mystyles/panel.scss: -------------------------------------------------------------------------------- 1 | .panel { 2 | color: $primary-color; 3 | } 4 | 5 | -------------------------------------------------------------------------------- /_old/step22_bootstrap_extend/src/routes/index.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import express = require('express'); 4 | var router = express.Router(); 5 | 6 | /* GET home page. */ 7 | router.get('/', function(req, res, next) { 8 | res.render('index', { title: 'Multi-page Express app using Typescript and Bootstrap' }); 9 | }); 10 | 11 | export = router; -------------------------------------------------------------------------------- /_old/step22_bootstrap_extend/src/routes/second.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import express = require('express'); 4 | var router = express.Router(); 5 | 6 | /* GET second page. */ 7 | router.get('/', function(req, res, next) { 8 | res.render('page2', { titleData: 'This is the second page' }); 9 | }); 10 | 11 | export = router; -------------------------------------------------------------------------------- /_old/step22_bootstrap_extend/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /_old/step22_bootstrap_extend/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | /// 6 | /// 7 | -------------------------------------------------------------------------------- /_old/step22_bootstrap_extend/views/page2.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Express Page 2 using Typescript 6 | 7 | 8 | 9 | 10 |

<%= titleData %>

11 | Back to main page 12 | 13 | 14 | -------------------------------------------------------------------------------- /_old/step23_es2015_modules/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | bower_components 3 | -------------------------------------------------------------------------------- /_old/step23_es2015_modules/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "step4_bootstrap", 3 | "version": "0.0.0", 4 | "homepage": "https://github.com/ziaukhan/learn-node-typescript", 5 | "authors": [ 6 | "Zia Khan " 7 | ], 8 | "moduleType": [ 9 | "amd", 10 | "node" 11 | ], 12 | "license": "MIT", 13 | "ignore": [ 14 | "**/.*", 15 | "node_modules", 16 | "bower_components", 17 | "test", 18 | "tests" 19 | ], 20 | "dependencies": { 21 | "bootstrap-sass": "~3.3.5" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /_old/step23_es2015_modules/built/models/User.js: -------------------------------------------------------------------------------- 1 | var User = (function () { 2 | function User(name) { 3 | this.name = name; 4 | } 5 | User.prototype.browsing = function () { 6 | return this.name + " is a User from a ES2015 class/module and is eating"; 7 | }; 8 | return User; 9 | })(); 10 | exports["default"] = User; 11 | -------------------------------------------------------------------------------- /_old/step23_es2015_modules/built/routes/index.js: -------------------------------------------------------------------------------- 1 | /// 2 | var express = require('express'); 3 | var router = express.Router(); 4 | /* GET home page. */ 5 | router.get('/', function (req, res, next) { 6 | res.render('index', { title: 'Multi-page Express app using Typescript and Bootstrap' }); 7 | }); 8 | module.exports = router; 9 | -------------------------------------------------------------------------------- /_old/step23_es2015_modules/built/routes/second.js: -------------------------------------------------------------------------------- 1 | /// 2 | var express = require('express'); 3 | var User_1 = require('../models/User'); 4 | var router = express.Router(); 5 | var u = new User_1["default"]("Zia"); 6 | /* GET second page. */ 7 | router.get('/', function (req, res, next) { 8 | res.render('page2', { titleData: u.browsing() }); 9 | }); 10 | module.exports = router; 11 | -------------------------------------------------------------------------------- /_old/step23_es2015_modules/public/img/typescript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/panacloud/learn-typed-express/abae539066747ea9a5afdd34ed137443ea1cb4cd/_old/step23_es2015_modules/public/img/typescript.png -------------------------------------------------------------------------------- /_old/step23_es2015_modules/readme.md: -------------------------------------------------------------------------------- 1 | Using ES2015 modules, check the code in routes/second.ts file 2 | 3 | Read: 4 | https://github.com/ziaukhan/learn-typescript/tree/master/step35_modules 5 | -------------------------------------------------------------------------------- /_old/step23_es2015_modules/sass/globals/variables.scss: -------------------------------------------------------------------------------- 1 | $font-size-base: 20px; -------------------------------------------------------------------------------- /_old/step23_es2015_modules/sass/main.scss: -------------------------------------------------------------------------------- 1 | // inject:global 2 | // endinject 3 | 4 | 5 | // bower:scss 6 | // endbower 7 | 8 | 9 | // inject:app 10 | // endinject -------------------------------------------------------------------------------- /_old/step23_es2015_modules/sass/mystyles/body.scss: -------------------------------------------------------------------------------- 1 | $primary-color: red; 2 | body { 3 | background-color: $primary-color; 4 | } 5 | -------------------------------------------------------------------------------- /_old/step23_es2015_modules/sass/mystyles/extend.scss: -------------------------------------------------------------------------------- 1 | .main-area { 2 | @extend .row; 3 | } 4 | .column { 5 | @extend .col-md-4; 6 | } 7 | .content { 8 | @extend .col-xs-6; 9 | @extend .col-sm-6; 10 | } 11 | .sidebar { 12 | @extend .col-xs-4; 13 | @extend .col-sm-4; 14 | } 15 | .side-nav { 16 | @extend .col-sm-2; 17 | @extend .col-sm-2; 18 | } -------------------------------------------------------------------------------- /_old/step23_es2015_modules/sass/mystyles/panel.scss: -------------------------------------------------------------------------------- 1 | .panel { 2 | color: $primary-color; 3 | } 4 | 5 | -------------------------------------------------------------------------------- /_old/step23_es2015_modules/src/models/User.ts: -------------------------------------------------------------------------------- 1 | export default class User { 2 | name: string; 3 | 4 | constructor(name: string){ 5 | this.name = name; 6 | } 7 | 8 | browsing(){ 9 | return this.name + " is a User from a ES2015 class/module and is eating"; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /_old/step23_es2015_modules/src/routes/index.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import express = require('express'); 4 | var router = express.Router(); 5 | 6 | /* GET home page. */ 7 | router.get('/', function(req, res, next) { 8 | res.render('index', { title: 'Multi-page Express app using Typescript and Bootstrap' }); 9 | }); 10 | 11 | export = router; -------------------------------------------------------------------------------- /_old/step23_es2015_modules/src/routes/second.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import express = require('express'); 4 | import User from '../models/User'; 5 | var router = express.Router(); 6 | 7 | var u: User = new User("Zia"); 8 | 9 | /* GET second page. */ 10 | router.get('/', function(req, res, next) { 11 | res.render('page2', { titleData: u.browsing() }); 12 | }); 13 | 14 | export = router; -------------------------------------------------------------------------------- /_old/step23_es2015_modules/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /_old/step23_es2015_modules/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | /// 6 | /// 7 | -------------------------------------------------------------------------------- /_old/step23_es2015_modules/views/page2.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Express Page 2 using Typescript 6 | 7 | 8 | 9 | 10 |

<%= titleData %>

11 | Back to main page 12 | 13 | 14 | -------------------------------------------------------------------------------- /_old/step24_angular2/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | node_modules 3 | npm-debug 4 | -------------------------------------------------------------------------------- /_old/step24_angular2/dist/client/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Angular 2 QuickStart 4 | 5 | 6 | 12 | 13 | 14 | Loading... 15 | 16 | -------------------------------------------------------------------------------- /_old/step24_angular2/src/client/app/app.ts: -------------------------------------------------------------------------------- 1 | import {Component, bootstrap} from 'angular2/angular2'; 2 | @Component({ 3 | selector: 'my-app', 4 | template: '

Angular 2 App with Typed Node.js

' 5 | }) 6 | class AppComponent { } 7 | bootstrap(AppComponent); -------------------------------------------------------------------------------- /_old/step24_angular2/src/client/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Angular 2 QuickStart 4 | 5 | 6 | 12 | 13 | 14 | Loading... 15 | 16 | -------------------------------------------------------------------------------- /_old/step24_angular2/src/client/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs", 5 | "sourceMap": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "removeComments": false, 9 | "noImplicitAny": false 10 | } 11 | } -------------------------------------------------------------------------------- /_old/step24_angular2/src/server/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /_old/step24_angular2/src/server/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | -------------------------------------------------------------------------------- /_old/step24_angular2/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es5" 5 | } 6 | } -------------------------------------------------------------------------------- /_old/step24_angular2/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | 2 | /// 3 | /// 4 | /// 5 | /// 6 | /// 7 | /// 8 | /// 9 | -------------------------------------------------------------------------------- /_old/step25_angular2_sass/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | node_modules 3 | npm-debug 4 | -------------------------------------------------------------------------------- /_old/step25_angular2_sass/dist/client/app/app.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | background: #eeffcc; } 3 | -------------------------------------------------------------------------------- /_old/step25_angular2_sass/dist/client/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Angular 2 QuickStart 4 | 5 | 6 | 12 | 13 | 14 | Loading... 15 | 16 | -------------------------------------------------------------------------------- /_old/step25_angular2_sass/src/client/app/app.scss: -------------------------------------------------------------------------------- 1 | $primaryColor: #eeffcc; 2 | 3 | h1 { 4 | background: $primaryColor; 5 | } -------------------------------------------------------------------------------- /_old/step25_angular2_sass/src/client/app/app.ts: -------------------------------------------------------------------------------- 1 | import {Component, bootstrap} from 'angular2/angular2'; 2 | @Component({ 3 | selector: 'my-app', 4 | template:` 5 |

Typed and SASS Styled Angular 2 and Node.js Web App

6 | `, 7 | styleUrls: ['app/app.css'] 8 | }) 9 | class AppComponent { } 10 | bootstrap(AppComponent); -------------------------------------------------------------------------------- /_old/step25_angular2_sass/src/client/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Angular 2 QuickStart 4 | 5 | 6 | 12 | 13 | 14 | Loading... 15 | 16 | -------------------------------------------------------------------------------- /_old/step25_angular2_sass/src/client/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs", 5 | "sourceMap": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "removeComments": false, 9 | "noImplicitAny": false 10 | } 11 | } -------------------------------------------------------------------------------- /_old/step25_angular2_sass/src/server/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /_old/step25_angular2_sass/src/server/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | -------------------------------------------------------------------------------- /_old/step25_angular2_sass/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es5" 5 | } 6 | } -------------------------------------------------------------------------------- /_old/step25_angular2_sass/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | 2 | /// 3 | /// 4 | /// 5 | /// 6 | /// 7 | /// 8 | /// 9 | /// 10 | -------------------------------------------------------------------------------- /_old/step26_angular2_sass_mocha/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | node_modules 3 | npm-debug 4 | -------------------------------------------------------------------------------- /_old/step26_angular2_sass_mocha/dist/client/app/app.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | background: #eeffcc; } 3 | -------------------------------------------------------------------------------- /_old/step26_angular2_sass_mocha/dist/client/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Angular 2 QuickStart 4 | 5 | 6 | 12 | 13 | 14 | Loading... 15 | 16 | -------------------------------------------------------------------------------- /_old/step26_angular2_sass_mocha/readme.md: -------------------------------------------------------------------------------- 1 | Read: 2 | http://dinozafirakos.com/2014/07/21/testing-with-mocha-chai-and-typescript/ 3 | http://shellmonger.com/2015/09/29/testing-a-nodejs-library-with-mocha-and-chai/ 4 | https://developmentnow.com/2015/02/05/make-your-node-js-api-bulletproof-how-to-test-with-mocha-chai-and-supertest/ 5 | 6 | First install node modules: 7 | npm install 8 | 9 | To run Tests frist start the server: 10 | npm start 11 | 12 | then to run tests: 13 | npm test -------------------------------------------------------------------------------- /_old/step26_angular2_sass_mocha/src/client/app/app.scss: -------------------------------------------------------------------------------- 1 | $primaryColor: #eeffcc; 2 | 3 | h1 { 4 | background: $primaryColor; 5 | } -------------------------------------------------------------------------------- /_old/step26_angular2_sass_mocha/src/client/app/app.ts: -------------------------------------------------------------------------------- 1 | import {Component, bootstrap} from 'angular2/angular2'; 2 | 3 | @Component({ 4 | selector: 'my-app', 5 | template:` 6 |

Typed and SASS Styled Angular 2 and Node.js Web App

7 | `, 8 | styleUrls: ['app/app.css'] 9 | }) 10 | class AppComponent { } 11 | bootstrap(AppComponent); -------------------------------------------------------------------------------- /_old/step26_angular2_sass_mocha/src/client/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Angular 2 QuickStart 4 | 5 | 6 | 12 | 13 | 14 | Loading... 15 | 16 | -------------------------------------------------------------------------------- /_old/step26_angular2_sass_mocha/src/client/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs", 5 | "sourceMap": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "removeComments": false, 9 | "noImplicitAny": false 10 | } 11 | } -------------------------------------------------------------------------------- /_old/step26_angular2_sass_mocha/src/server/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /_old/step26_angular2_sass_mocha/src/server/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | -------------------------------------------------------------------------------- /_old/step26_angular2_sass_mocha/test/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es5" 5 | } 6 | } -------------------------------------------------------------------------------- /_old/step26_angular2_sass_mocha/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es5" 5 | } 6 | } -------------------------------------------------------------------------------- /_old/step26_angular2_sass_mocha/typings/gulp-mocha/gulp-mocha.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for gulp-mocha 2 | // Project: https://github.com/sindresorhus/gulp-mocha 3 | // Definitions by: Asana 4 | // Definitions: https://github.com/borisyankov/DefinitelyTyped 5 | 6 | /// 7 | /// 8 | 9 | declare module "gulp-mocha" { 10 | function mocha(setupOptions?: MochaSetupOptions): NodeJS.ReadWriteStream; 11 | export = mocha; 12 | } -------------------------------------------------------------------------------- /_old/step2_middlewares/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /_old/step2_middlewares/public/img/typescript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/panacloud/learn-typed-express/abae539066747ea9a5afdd34ed137443ea1cb4cd/_old/step2_middlewares/public/img/typescript.png -------------------------------------------------------------------------------- /_old/step2_middlewares/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /_old/step2_middlewares/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | /// 6 | -------------------------------------------------------------------------------- /_old/step2_middlewares/views/index.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Express using Typescript 6 | 7 | 8 | 9 | 10 |

Hello Express using TypeScript

11 | some_text 12 | 13 | 14 | -------------------------------------------------------------------------------- /_old/step3_middlewares-multiple/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /_old/step3_middlewares-multiple/public/img/typescript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/panacloud/learn-typed-express/abae539066747ea9a5afdd34ed137443ea1cb4cd/_old/step3_middlewares-multiple/public/img/typescript.png -------------------------------------------------------------------------------- /_old/step3_middlewares-multiple/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /_old/step3_middlewares-multiple/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | /// 6 | -------------------------------------------------------------------------------- /_old/step3_middlewares-multiple/views/index.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Express using Typescript 6 | 7 | 8 | 9 | 10 |

Hello Express using TypeScript

11 | some_text 12 | 13 | 14 | -------------------------------------------------------------------------------- /_old/step4_middlewares-error-handling/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /_old/step4_middlewares-error-handling/public/img/typescript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/panacloud/learn-typed-express/abae539066747ea9a5afdd34ed137443ea1cb4cd/_old/step4_middlewares-error-handling/public/img/typescript.png -------------------------------------------------------------------------------- /_old/step4_middlewares-error-handling/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /_old/step4_middlewares-error-handling/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | /// 6 | -------------------------------------------------------------------------------- /_old/step4_middlewares-error-handling/views/index.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Express using Typescript 6 | 7 | 8 | 9 | 10 |

Hello Express using TypeScript

11 | some_text 12 | 13 | 14 | -------------------------------------------------------------------------------- /_old/step5_middlewares-mounting/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /_old/step5_middlewares-mounting/public/img/typescript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/panacloud/learn-typed-express/abae539066747ea9a5afdd34ed137443ea1cb4cd/_old/step5_middlewares-mounting/public/img/typescript.png -------------------------------------------------------------------------------- /_old/step5_middlewares-mounting/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /_old/step5_middlewares-mounting/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | /// 6 | -------------------------------------------------------------------------------- /_old/step5_middlewares-mounting/views/index.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Express using Typescript 6 | 7 | 8 | 9 | 10 |

Hello Express using TypeScript

11 | some_text 12 | 13 | 14 | -------------------------------------------------------------------------------- /_old/step6_middlewares-routes/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /_old/step6_middlewares-routes/public/img/typescript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/panacloud/learn-typed-express/abae539066747ea9a5afdd34ed137443ea1cb4cd/_old/step6_middlewares-routes/public/img/typescript.png -------------------------------------------------------------------------------- /_old/step6_middlewares-routes/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /_old/step6_middlewares-routes/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | /// 6 | -------------------------------------------------------------------------------- /_old/step6_middlewares-routes/views/index.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Express using Typescript 6 | 7 | 8 | 9 | 10 |

Hello Express using TypeScript

11 | some_text 12 | 13 | 14 | -------------------------------------------------------------------------------- /_old/step7_routing/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /_old/step7_routing/built/routes/index.js: -------------------------------------------------------------------------------- 1 | /// 2 | var express = require('express'); 3 | var router = express.Router(); 4 | /* GET home page. */ 5 | router.get('/', function (req, res, next) { 6 | res.render('index', { title: 'Multi-page Express app using Typescript' }); 7 | }); 8 | module.exports = router; 9 | -------------------------------------------------------------------------------- /_old/step7_routing/built/routes/second.js: -------------------------------------------------------------------------------- 1 | /// 2 | var express = require('express'); 3 | var router = express.Router(); 4 | /* GET second page. */ 5 | router.get('/', function (req, res, next) { 6 | res.render('page2', { titleData: 'This is the second page' }); 7 | }); 8 | module.exports = router; 9 | -------------------------------------------------------------------------------- /_old/step7_routing/public/img/typescript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/panacloud/learn-typed-express/abae539066747ea9a5afdd34ed137443ea1cb4cd/_old/step7_routing/public/img/typescript.png -------------------------------------------------------------------------------- /_old/step7_routing/readme.md: -------------------------------------------------------------------------------- 1 | Read: 2 | https://github.com/czechboy0/Express-4x-Typescript-Sample -------------------------------------------------------------------------------- /_old/step7_routing/src/routes/index.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import express = require('express'); 4 | var router = express.Router(); 5 | 6 | /* GET home page. */ 7 | router.get('/', function(req, res, next) { 8 | res.render('index', { title: 'Multi-page Express app using Typescript' }); 9 | }); 10 | 11 | export = router; -------------------------------------------------------------------------------- /_old/step7_routing/src/routes/second.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import express = require('express'); 4 | var router = express.Router(); 5 | 6 | /* GET second page. */ 7 | router.get('/', function(req, res, next) { 8 | res.render('page2', { titleData: 'This is the second page' }); 9 | }); 10 | 11 | export = router; -------------------------------------------------------------------------------- /_old/step7_routing/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /_old/step7_routing/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | /// 6 | /// 7 | -------------------------------------------------------------------------------- /_old/step7_routing/views/index.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Express using Typescript 6 | 7 | 8 | 9 | 10 |

<%= title %>

11 | some_text 12 | Go to second page 13 | 14 | -------------------------------------------------------------------------------- /_old/step7_routing/views/page2.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Express Page 2 using Typescript 6 | 7 | 8 | 9 | 10 |

<%= titleData %>

11 | Back to main page 12 | 13 | 14 | -------------------------------------------------------------------------------- /_old/step8_ejs/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /_old/step8_ejs/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.1.0", 3 | "command": "gulp", 4 | "isShellCommand": true, 5 | "args": [ 6 | "--no-color" 7 | ], 8 | "tasks": [ 9 | { 10 | "taskName": "buildServer", 11 | "args": [], 12 | "isBuildCommand": true, 13 | "isWatching": false, 14 | "problemMatcher": [ 15 | "$lessCompile", 16 | "$tsc", 17 | "$jshint" 18 | ] 19 | } 20 | ] 21 | } -------------------------------------------------------------------------------- /_old/step8_ejs/public/img/typescript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/panacloud/learn-typed-express/abae539066747ea9a5afdd34ed137443ea1cb4cd/_old/step8_ejs/public/img/typescript.png -------------------------------------------------------------------------------- /_old/step8_ejs/readme.md: -------------------------------------------------------------------------------- 1 | # ejs: 2 | Embedded JavaScript templates 3 | 4 | - Control flow with <% %> 5 | - Escaped output with <%= %> 6 | - Unescaped raw output with <%- %> 7 | - Includes 8 | 9 | Usage: 10 | 11 | - <% 'Scriptlet' tag, for control-flow, no output 12 | - <%= Outputs the value into the template (HTML escaped) 13 | - <%- Outputs the unescaped value into the template 14 | - <%# Comment tag, no execution, no output 15 | - %> Plain ending tag -------------------------------------------------------------------------------- /_old/step8_ejs/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /_old/step8_ejs/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | /// 6 | /// 7 | -------------------------------------------------------------------------------- /_old/step8_ejs/views/partial.ejs: -------------------------------------------------------------------------------- 1 |
2 |

Partial EJS to include

3 |
-------------------------------------------------------------------------------- /_old/step9_querystring/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /_old/step9_querystring/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.1.0", 3 | "command": "gulp", 4 | "isShellCommand": true, 5 | "args": [ 6 | "--no-color" 7 | ], 8 | "tasks": [ 9 | { 10 | "taskName": "buildServer", 11 | "args": [], 12 | "isBuildCommand": true, 13 | "isWatching": false, 14 | "problemMatcher": [ 15 | "$lessCompile", 16 | "$tsc", 17 | "$jshint" 18 | ] 19 | } 20 | ] 21 | } -------------------------------------------------------------------------------- /_old/step9_querystring/public/img/typescript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/panacloud/learn-typed-express/abae539066747ea9a5afdd34ed137443ea1cb4cd/_old/step9_querystring/public/img/typescript.png -------------------------------------------------------------------------------- /_old/step9_querystring/readme.md: -------------------------------------------------------------------------------- 1 | # req.query: 2 | An object containing a property for each query string parameter in the route. If there is no query string, it is the empty object, {}. 3 | 4 | // GET /search?q=tobi+ferret 5 | req.query.q 6 | // => "tobi ferret" 7 | 8 | // GET /shoes?order=desc&shoe[color]=blue&shoe[type]=converse 9 | req.query.order 10 | // => "desc" 11 | 12 | req.query.shoe.color 13 | // => "blue" 14 | 15 | req.query.shoe.type 16 | // => "converse" -------------------------------------------------------------------------------- /_old/step9_querystring/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /_old/step9_querystring/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | /// 6 | /// 7 | -------------------------------------------------------------------------------- /_old/step_test_spa/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | node_modules 3 | npm-debug 4 | -------------------------------------------------------------------------------- /_old/step_test_spa/client/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Express using Typescript 6 | 7 | 8 | 9 | 10 |

Hello Express using TypeScript

11 | 12 | 13 | -------------------------------------------------------------------------------- /_old/step_test_spa/dist/client/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Express using Typescript 6 | 7 | 8 | 9 | 10 |

Hello Express using TypeScript

11 | 12 | 13 | -------------------------------------------------------------------------------- /_old/step_test_spa/readme.md: -------------------------------------------------------------------------------- 1 | Read: 2 | A flexiable structure that can be used with Angular 1.x, Aungular 2, and Firebase hosting as well. -------------------------------------------------------------------------------- /_old/step_test_spa/server/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /_old/step_test_spa/server/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/.nvmrc: -------------------------------------------------------------------------------- 1 | v0.12 2 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_01/express_hello_world/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_01/express_hello_world/app.js: -------------------------------------------------------------------------------- 1 | /// 2 | var express = require("express"); 3 | var app = express(); 4 | app.get("/", function (request, response) { 5 | response.send("Hello world!"); 6 | }); 7 | app.listen(3000, function () { 8 | console.log("Express app started on port 3000."); 9 | }); 10 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_01/express_hello_world/app.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import express = require("express"); 4 | 5 | var app = express(); 6 | 7 | app.get("/", (request : express.Request, response: express.Response) => { 8 | response.send("Hello world!"); 9 | }); 10 | 11 | app.listen(3000, () => { 12 | console.log("Express app started on port 3000."); 13 | }); 14 | 15 | 16 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_01/express_hello_world/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "start": "node app" 5 | }, 6 | "dependencies": { 7 | "express": "^5.0.0-alpha.2" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_01/express_hello_world/readme.md: -------------------------------------------------------------------------------- 1 | Listing 1.1 “Hello World” in Express in TypeScript from the Book Express in Action: 2 | 3 | https://www.manning.com/books/express-in-action 4 | 5 | 6 | Express 5 Update: 7 | http://expressjs.com/guide/migrating-5.html -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_01/express_hello_world/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_01/express_hello_world/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | 2 | /// 3 | /// 4 | /// 5 | /// 6 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/built_in_modules/app.js: -------------------------------------------------------------------------------- 1 | /// 2 | var url = require("url"); 3 | var parsedURL = url.parse("http://www.example.com/profile?name=barry"); 4 | console.log(parsedURL.protocol); // "http:" 5 | console.log(parsedURL.host); // "www.example.com" 6 | console.log(parsedURL.query); // "name=barry" 7 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/built_in_modules/app.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import url = require("url"); 4 | var parsedURL = url.parse("http://www.example.com/profile?name=barry"); 5 | console.log(parsedURL.protocol); // "http:" 6 | console.log(parsedURL.host); // "www.example.com" 7 | console.log(parsedURL.query);// "name=barry" 8 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/built_in_modules/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "start": "node app" 5 | }, 6 | "dependencies": { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/built_in_modules/readme.md: -------------------------------------------------------------------------------- 1 | Listing 2.2 Requiring Node's URL module in TypeScript from the Book Express in Action: 2 | 3 | https://www.manning.com/books/express-in-action -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/built_in_modules/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/built_in_modules/tsd.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "v4", 3 | "repo": "borisyankov/DefinitelyTyped", 4 | "ref": "master", 5 | "path": "typings", 6 | "bundle": "typings/tsd.d.ts", 7 | "installed": { 8 | "node/node.d.ts": { 9 | "commit": "ac5cd185d007f6aacd6eeaaecfb75dae3ff59553" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/built_in_modules/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | 2 | /// 3 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/defining_modules_es2015/app.js: -------------------------------------------------------------------------------- 1 | /// 2 | var random_integer_1 = require("./random-integer"); 3 | console.log(random_integer_1.randomInteger()); // 12 4 | console.log(random_integer_1.randomInteger()); // 77 5 | console.log(random_integer_1.randomInteger()); // 8 6 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/defining_modules_es2015/app.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import {randomInteger} from "./random-integer"; 4 | console.log(randomInteger()); 5 | console.log(randomInteger()); 6 | console.log(randomInteger()); -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/defining_modules_es2015/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "start": "node app" 5 | }, 6 | "dependencies": { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/defining_modules_es2015/random-integer.js: -------------------------------------------------------------------------------- 1 | /// 2 | var MAX = 100; 3 | function randomInteger() { 4 | return Math.floor((Math.random() * MAX)); 5 | } 6 | exports.randomInteger = randomInteger; 7 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/defining_modules_es2015/random-integer.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | var MAX = 100; 4 | export function randomInteger() { 5 | return Math.floor((Math.random() * MAX)); 6 | } 7 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/defining_modules_es2015/readme.md: -------------------------------------------------------------------------------- 1 | Listing 2.9 and 2.10 in TypeScript from the Book Express in Action: 2 | 3 | https://www.manning.com/books/express-in-action 4 | 5 | The TypeScript Version uses ES2015 (ES6) Module Syntax: 6 | 7 | http://www.2ality.com/2014/09/es6-modules-final.html -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/defining_modules_es2015/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/defining_modules_es2015/tsd.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "v4", 3 | "repo": "borisyankov/DefinitelyTyped", 4 | "ref": "master", 5 | "path": "typings", 6 | "bundle": "typings/tsd.d.ts", 7 | "installed": { 8 | "node/node.d.ts": { 9 | "commit": "ac5cd185d007f6aacd6eeaaecfb75dae3ff59553" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/defining_modules_es2015/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | 2 | /// 3 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/node_hello_world/app.js: -------------------------------------------------------------------------------- 1 | /// 2 | console.log("Hello World!"); 3 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/node_hello_world/app.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | console.log("Hello World!"); 4 | 5 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/node_hello_world/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "start": "node app" 5 | }, 6 | "dependencies": { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/node_hello_world/readme.md: -------------------------------------------------------------------------------- 1 | Express 5 Update: 2 | http://expressjs.com/guide/migrating-5.html -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/node_hello_world/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/node_hello_world/tsd.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "v4", 3 | "repo": "borisyankov/DefinitelyTyped", 4 | "ref": "master", 5 | "path": "typings", 6 | "bundle": "typings/tsd.d.ts", 7 | "installed": { 8 | "node/node.d.ts": { 9 | "commit": "ac5cd185d007f6aacd6eeaaecfb75dae3ff59553" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/node_hello_world/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | 2 | /// 3 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/node_webserver/app.js: -------------------------------------------------------------------------------- 1 | /// 2 | var http = require("http"); 3 | function requestHandler(request, response) { 4 | console.log("In comes a request to: " + request.url); 5 | response.end("Hello, world!"); 6 | } 7 | var server = http.createServer(requestHandler); 8 | server.listen(3000); 9 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/node_webserver/app.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import http = require("http"); 4 | function requestHandler(request: http.IncomingMessage, response: http.ServerResponse) { 5 | console.log("In comes a request to: " + request.url); 6 | response.end("Hello, world!"); 7 | } 8 | var server: http.Server = http.createServer(requestHandler); 9 | server.listen(3000); -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/node_webserver/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "start": "node app" 5 | }, 6 | "dependencies": { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/node_webserver/readme.md: -------------------------------------------------------------------------------- 1 | Listing 2.13 A simple "hello world" web server with Node in TypeScript from the Book Express in Action: 2 | 3 | https://www.manning.com/books/express-in-action -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/node_webserver/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/node_webserver/tsd.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "v4", 3 | "repo": "borisyankov/DefinitelyTyped", 4 | "ref": "master", 5 | "path": "typings", 6 | "bundle": "typings/tsd.d.ts", 7 | "installed": { 8 | "node/node.d.ts": { 9 | "commit": "ac5cd185d007f6aacd6eeaaecfb75dae3ff59553" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/node_webserver/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | 2 | /// 3 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/node_webserver_routing/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "start": "node app" 5 | }, 6 | "dependencies": { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/node_webserver_routing/readme.md: -------------------------------------------------------------------------------- 1 | Listing 2.14 Parsing the request URL with a request handler function in TypeScript from the Book Express in Action: 2 | 3 | https://www.manning.com/books/express-in-action -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/node_webserver_routing/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/node_webserver_routing/tsd.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "v4", 3 | "repo": "borisyankov/DefinitelyTyped", 4 | "ref": "master", 5 | "path": "typings", 6 | "bundle": "typings/tsd.d.ts", 7 | "installed": { 8 | "node/node.d.ts": { 9 | "commit": "ac5cd185d007f6aacd6eeaaecfb75dae3ff59553" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/node_webserver_routing/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | 2 | /// 3 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/reading_file_async/app.js: -------------------------------------------------------------------------------- 1 | /// 2 | var fs = require("fs"); 3 | var options = { encoding: "utf-8" }; 4 | fs.readFile("myfile.txt", options, function (err, data) { 5 | if (err) { 6 | console.error("Error reading file!"); 7 | return; 8 | } 9 | console.log(data.match(/x/gi).length + " letter X's"); 10 | }); 11 | console.log("Hello world!"); 12 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/reading_file_async/app.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import fs = require("fs"); 4 | var options = { encoding: "utf-8" }; 5 | 6 | fs.readFile("myfile.txt", options, (err: NodeJS.ErrnoException, data: string)=> { 7 | if (err) { 8 | console.error("Error reading file!"); 9 | return; 10 | } 11 | console.log(data.match(/x/gi).length + " letter X's"); 12 | }); 13 | 14 | console.log("Hello world!"); 15 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/reading_file_async/myfile.txt: -------------------------------------------------------------------------------- 1 | x = a + b; -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/reading_file_async/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "start": "node app" 5 | }, 6 | "dependencies": { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/reading_file_async/readme.md: -------------------------------------------------------------------------------- 1 | Listing 2.11 and 2.12 in TypeScript from the Book Express in Action: 2 | 3 | https://www.manning.com/books/express-in-action -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/reading_file_async/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/reading_file_async/tsd.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "v4", 3 | "repo": "borisyankov/DefinitelyTyped", 4 | "ref": "master", 5 | "path": "typings", 6 | "bundle": "typings/tsd.d.ts", 7 | "installed": { 8 | "node/node.d.ts": { 9 | "commit": "ac5cd185d007f6aacd6eeaaecfb75dae3ff59553" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/reading_file_async/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | 2 | /// 3 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/third_party_modules/app.js: -------------------------------------------------------------------------------- 1 | /// 2 | var Mustache = require("mustache"); 3 | var result = Mustache.render("Hi, {{first}} {{last}}!", { 4 | first: "Nicolas", 5 | last: "Cage" 6 | }); 7 | console.log(result); 8 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/third_party_modules/app.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import Mustache = require("mustache"); 4 | var result = Mustache.render("Hi, {{first}} {{last}}!", { 5 | first: "Nicolas", 6 | last: "Cage" 7 | }); 8 | console.log(result); -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/third_party_modules/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "start": "node app" 5 | }, 6 | "dependencies": { 7 | "mustache": "^2.2.0" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/third_party_modules/readme.md: -------------------------------------------------------------------------------- 1 | Listing 2.7 Using the Mustache module in TypeScript from the Book Express in Action: 2 | 3 | https://www.manning.com/books/express-in-action -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/third_party_modules/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/third_party_modules/tsd.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "v4", 3 | "repo": "borisyankov/DefinitelyTyped", 4 | "ref": "master", 5 | "path": "typings", 6 | "bundle": "typings/tsd.d.ts", 7 | "installed": { 8 | "node/node.d.ts": { 9 | "commit": "ac5cd185d007f6aacd6eeaaecfb75dae3ff59553" 10 | }, 11 | "mustache/mustache.d.ts": { 12 | "commit": "0dd29bf8253536ae24e61c109524e924ea510046" 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_02/third_party_modules/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | 2 | /// 3 | /// 4 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_03/guestbook/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_03/guestbook/app.js: -------------------------------------------------------------------------------- 1 | /// 2 | console.log(require('url').parse('http://localhost:3000/1?p=2').pathname); 3 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_03/guestbook/app.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import url = require('url'); 4 | console.log(require('url').parse('http://localhost:3000/1?p=2').pathname); 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_03/guestbook/converter.js: -------------------------------------------------------------------------------- 1 | /// 2 | var Converter1 = (function () { 3 | function Converter1() { 4 | } 5 | Converter1.setRate = function (rate) { 6 | Converter1.rate = rate; 7 | }; 8 | Converter1.rupeeToDollar = function (rupee) { 9 | return rupee / Converter1.rate; 10 | }; 11 | Converter1.rate = 100; 12 | return Converter1; 13 | })(); 14 | exports.Converter1 = Converter1; 15 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_03/guestbook/converter.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | export class Converter1{ 4 | static rate = 100; 5 | 6 | static setRate(rate: number){ 7 | Converter1.rate = rate; 8 | } 9 | 10 | static rupeeToDollar(rupee: number){ 11 | return rupee / Converter1.rate; 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_03/guestbook/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Hello World 8 | 9 | 10 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_03/guestbook/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "express-guestbook", 3 | "private": true, 4 | "scripts": { 5 | "start": "node app" 6 | }, 7 | "dependencies": { 8 | "body-parser": "^1.13.2", 9 | "ejs": "^2.3.3", 10 | "express": "^5.0.0-alpha.2", 11 | "morgan": "^1.6.1" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_03/guestbook/readme.md: -------------------------------------------------------------------------------- 1 | Listing 3.19 to 3.25 in TypeScript from the Book Express in Action: 2 | 3 | https://www.manning.com/books/express-in-action -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_03/guestbook/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_03/guestbook/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | 2 | /// 3 | /// 4 | /// 5 | /// 6 | /// 7 | /// 8 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_03/guestbook/views/404.ejs: -------------------------------------------------------------------------------- 1 | <% include header %> 2 |

404! Page not found.

3 | <% include footer %> -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_03/guestbook/views/footer.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_03/guestbook/views/header.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Express Guestbook 6 | 7 | 8 | 9 |

10 | Express Guestbook 11 | 12 | Write in the guestbook 13 | 14 |

15 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_03/hello-world/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_03/hello-world/app-simple.js: -------------------------------------------------------------------------------- 1 | /// 2 | var express = require("express"); 3 | var http = require("http"); 4 | var app = express(); 5 | app.use(function (request, response) { 6 | response.writeHead(200, { "Content-Type": "text/plain" }); 7 | response.end("Hello, World!"); 8 | }); 9 | http.createServer(app).listen(3000); 10 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_03/hello-world/app-simple.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import express = require("express"); 4 | import http = require("http"); 5 | 6 | var app = express(); 7 | 8 | app.use((request: express.Request, response: express.Response) => { 9 | response.writeHead(200, { "Content-Type": "text/plain" }); 10 | response.end("Hello, World!"); 11 | }); 12 | 13 | http.createServer(app).listen(3000); 14 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_03/hello-world/cool-facts.txt: -------------------------------------------------------------------------------- 1 | - dogs are cool 2 | - cats are cool 3 | - ??? 4 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_03/hello-world/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "name": "chapter3", 4 | "version": "1", 5 | "scripts": { 6 | "start": "node app", 7 | "tsc": "tsc --module commonjs -p ." 8 | }, 9 | "dependencies": { 10 | "express": "^5.0.0-alpha.2", 11 | "morgan": "^1.6.1" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_03/hello-world/readme.md: -------------------------------------------------------------------------------- 1 | Chapter 3 code in TypeScript from the Book Express in Action: 2 | 3 | https://www.manning.com/books/express-in-action -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_03/hello-world/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_03/hello-world/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | 2 | /// 3 | /// 4 | /// 5 | /// 6 | /// 7 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_03/routing/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_03/routing/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "start": "node app" 5 | }, 6 | "dependencies": { 7 | "express": "^5.0.0-alpha.2", 8 | "morgan": "^1.6.1" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_03/routing/public/file.txt: -------------------------------------------------------------------------------- 1 | This is a sample static file! 2 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_03/routing/readme.md: -------------------------------------------------------------------------------- 1 | Listing 3.10 Express routing example in TypeScript from the Book Express in Action: 2 | 3 | https://www.manning.com/books/express-in-action -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_03/routing/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_03/routing/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | 2 | /// 3 | /// 4 | /// 5 | /// 6 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_03/statics/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_03/statics/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "start": "node app" 5 | }, 6 | "dependencies": { 7 | "express": "^5.0.0-alpha.2", 8 | "morgan": "^1.6.1" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_03/statics/public/file.txt: -------------------------------------------------------------------------------- 1 | This is a sample static file! 2 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_03/statics/readme.md: -------------------------------------------------------------------------------- 1 | Listing 3.9 Using express.static in TypeScript from the Book Express in Action: 2 | 3 | https://www.manning.com/books/express-in-action -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_03/statics/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_03/statics/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | 2 | /// 3 | /// 4 | /// 5 | /// 6 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_03/views-example/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_03/views-example/app.js: -------------------------------------------------------------------------------- 1 | /// 2 | var express = require("express"); 3 | var http = require("http"); 4 | var path = require("path"); 5 | var app = express(); 6 | app.set("views", path.resolve(__dirname, "views")); 7 | app.set("view engine", "ejs"); 8 | app.get("/", function (request, response) { 9 | response.render("index", { 10 | message: "Hey everyone! This is my webpage." 11 | }); 12 | }); 13 | http.createServer(app).listen(3000); 14 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_03/views-example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "start": "node app" 5 | }, 6 | "dependencies": { 7 | "ejs": "^2.3.3", 8 | "express": "^5.0.0-alpha.2", 9 | "morgan": "^1.6.1" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_03/views-example/readme.md: -------------------------------------------------------------------------------- 1 | Listing 3.15, 3.16, 3.17, and 3.18 in TypeScript from the Book Express in Action: 2 | 3 | https://www.manning.com/books/express-in-action -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_03/views-example/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_03/views-example/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | 2 | /// 3 | /// 4 | /// 5 | /// 6 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_03/views-example/views/index.ejs: -------------------------------------------------------------------------------- 1 | Hello, world <%= message %> -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_04/error-stack/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_04/error-stack/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "start": "node app" 5 | }, 6 | "dependencies": { 7 | "express": "^5.0.0-alpha.2", 8 | "morgan": "^1.6.1" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_04/error-stack/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_04/error-stack/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | 2 | /// 3 | /// 4 | /// 5 | /// 6 | /// 7 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_04/static-file-fun/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_04/static-file-fun/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "start": "node app" 5 | }, 6 | "dependencies": { 7 | "express": "^5.0.0-alpha.2", 8 | "morgan": "^1.6.1" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_04/static-file-fun/static/hello.txt: -------------------------------------------------------------------------------- 1 | Hello World! -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_04/static-file-fun/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_04/static-file-fun/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | 2 | /// 3 | /// 4 | /// 5 | /// 6 | /// 7 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_05/temperature-by-zip-code/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_05/temperature-by-zip-code/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "temperature-by-zip", 3 | "private": true, 4 | "scripts": { 5 | "start": "node app.js" 6 | }, 7 | "dependencies": { 8 | "ejs": "^2.3.1", 9 | "express": "5.0.0-alpha.2", 10 | "forecastio": "^0.2.0", 11 | "zippity-do-dah": "0.0.x" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_05/temperature-by-zip-code/public/the.css: -------------------------------------------------------------------------------- 1 | html { 2 | display: table; 3 | width: 100%; 4 | height: 100%; 5 | } 6 | body { 7 | display: table-cell; 8 | vertical-align: middle; 9 | text-align: center; 10 | } 11 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_05/temperature-by-zip-code/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_05/temperature-by-zip-code/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | 2 | /// 3 | /// 4 | /// 5 | /// 6 | /// 7 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_05/temperature-by-zip-code/views/404.ejs: -------------------------------------------------------------------------------- 1 | <% include header %> 2 | 3 |

404 error! File not found.

4 | 5 | <% include footer %> 6 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_05/temperature-by-zip-code/views/footer.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_05/temperature-by-zip-code/views/header.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Temperature by ZIP code 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_05/temperature-by-zip-code/views/index.ejs: -------------------------------------------------------------------------------- 1 | <% include header %> 2 | 3 |

What's your ZIP code?

4 | 5 |
6 |
7 | 8 | 9 |
10 |
11 | 12 | 13 | 14 | 15 | <% include footer %> 16 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_06/random-number-api/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_06/random-number-api/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "random-number-api", 3 | "private": true, 4 | "scripts": { 5 | "start": "node app" 6 | }, 7 | "dependencies": { 8 | "express": "5.0.0-alpha.2" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_06/random-number-api/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_06/random-number-api/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | 2 | /// 3 | /// 4 | /// 5 | /// 6 | /// 7 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_08/learn-about-me/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_08/learn-about-me/random-number-api/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_08/learn-about-me/random-number-api/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "random-number-api", 3 | "private": true, 4 | "scripts": { 5 | "start": "node app" 6 | }, 7 | "dependencies": { 8 | "express": "5.0.0-alpha.2" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_08/learn-about-me/random-number-api/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_08/learn-about-me/random-number-api/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | 2 | /// 3 | /// 4 | /// 5 | /// 6 | /// 7 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_08/learn-about-me/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_08/learn-about-me/views/_footer.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_08/learn-about-me/views/index.ejs: -------------------------------------------------------------------------------- 1 | <% include _header %> 2 | 3 |

Welcome to Learn About Me!

4 | 5 | <% users.forEach(function(user) { %> 6 | 7 |
8 | 13 | <% if (user.bio) { %> 14 |
<%= user.bio %>
15 | <% } %> 16 |
17 | 18 | <% }) %> 19 | 20 | <% include _footer %> 21 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_08/learn-about-me/views/login.ejs: -------------------------------------------------------------------------------- 1 | <% include _header %> 2 | 3 |

Log in

4 | 5 |
6 | 7 | 8 | 9 |
10 | 11 | <% include _footer %> 12 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_08/learn-about-me/views/profile.ejs: -------------------------------------------------------------------------------- 1 | <% include _header %> 2 | 3 | <% if ((currentUser) && (currentUser.id === user.id)) { %> 4 | Edit your profile 5 | <% } %> 6 | 7 |

<%= user.name() %>

8 |

Joined on <%= user.createdAt %>

9 | 10 | <% if (user.bio) { %> 11 |

<%= user.bio %>

12 | <% } %> 13 | 14 | <% include _footer %> 15 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_08/learn-about-me/views/signup.ejs: -------------------------------------------------------------------------------- 1 | <% include _header %> 2 | 3 |

Sign up

4 | 5 |
6 | 7 | 8 | 9 |
10 | 11 | <% include _footer %> 12 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_09/simple_tests/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | *.log 3 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_09/simple_tests/capitalize.js: -------------------------------------------------------------------------------- 1 | function capitalize(str) { 2 | var firstLetter = str.charAt(0).toUpperCase(); 3 | var rest = str.slice(1).toLowerCase(); 4 | return firstLetter + rest; 5 | } 6 | 7 | module.exports = capitalize; 8 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_09/simple_tests/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "devDependencies": { 4 | "chai": "^1.9.2", 5 | "mocha": "^2.0.1" 6 | }, 7 | "scripts": { 8 | "test": "mocha" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_09/simple_tests/test/mocha.opts: -------------------------------------------------------------------------------- 1 | --check-leaks 2 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_09/whats_my_useragent/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | *.log 3 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_09/whats_my_useragent/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "whats-my-user-agent", 3 | "private": true, 4 | "scripts": { 5 | "start": "node app", 6 | "test": "mocha" 7 | }, 8 | "dependencies": { 9 | "ejs": "^1.0.0", 10 | "express": "5.0.0-alpha.1" 11 | }, 12 | "devDependencies": { 13 | "cheerio": "^0.17.0", 14 | "mocha": "^2.0.1", 15 | "supertest": "^0.14.0" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_09/whats_my_useragent/views/index.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 14 | 15 | 16 | 17 | 18 |

Your User Agent is:

19 |

20 | <%= userAgent %> 21 |

22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_10/csrf-example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "start": "node app" 5 | }, 6 | "dependencies": { 7 | "body-parser": "^1.10.2", 8 | "csurf": "^1.6.5", 9 | "ejs": "^2.2.3", 10 | "express": "^4.11.1", 11 | "express-session": "^1.10.1" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_10/csrf-example/views/index.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | CSRF example 7 | 8 | 9 | 10 | 11 |

CSRF form test

12 | 13 |
14 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_10/forever-example/app.js: -------------------------------------------------------------------------------- 1 | var express = require("express"); 2 | 3 | var app = express(); 4 | 5 | app.get("/", function(req, res) { 6 | res.send("Visit /crash to crash the site!"); 7 | }); 8 | 9 | app.get("/crash", function(req, res) { 10 | res.status(500); 11 | res.send("Crashing the site..."); 12 | process.exit(0); 13 | }); 14 | 15 | app.listen(3000, function() { 16 | console.log("App started"); 17 | }); 18 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_10/forever-example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "start": "forever app.js" 5 | }, 6 | "dependencies": { 7 | "express": "5.0.0-alpha.2", 8 | "forever": "^0.13.0" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_10/print-queries/app.js: -------------------------------------------------------------------------------- 1 | var express = require("express"); 2 | var util = require("util"); 3 | 4 | var app = express(); 5 | 6 | app.set("port", process.env.PORT || 3000); 7 | 8 | app.use(function(req, res) { 9 | res.type("text/plain"); 10 | res.send([ 11 | "req.query looks like this:", 12 | util.inspect(req.query) 13 | ].join("\n\n")); 14 | }); 15 | 16 | app.listen(app.get("port"), function() { 17 | console.log("App started on port " + app.get("port")); 18 | }); 19 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_10/print-queries/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "start": "node app" 5 | }, 6 | "dependencies": { 7 | "express": "5.0.0-alpha.2" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_11/grunt-examples/.gitignore: -------------------------------------------------------------------------------- 1 | tmp 2 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_11/grunt-examples/app.js: -------------------------------------------------------------------------------- 1 | var express = require("express"); 2 | var path = require("path"); 3 | 4 | var app = express(); 5 | 6 | app.use(express.static(path.resolve(__dirname, "public"))); 7 | app.use(express.static(path.resolve(__dirname, "tmp/serve"))); 8 | 9 | app.listen(3000, function() { 10 | console.log("App started on port 3000."); 11 | }); 12 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_11/grunt-examples/my_css/main.less: -------------------------------------------------------------------------------- 1 | article { 2 | display: block; 3 | h1 { 4 | font-size: 16pt; 5 | color: #900; 6 | } 7 | p { 8 | line-height: 1.5em; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_11/grunt-examples/my_javascripts/main.js: -------------------------------------------------------------------------------- 1 | var randomString = require("random-string"); 2 | 3 | console.log(randomString({ length: 10 })); 4 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_11/heroku-app/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_11/heroku-app/Procfile: -------------------------------------------------------------------------------- 1 | web: npm run production 2 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_11/heroku-app/app.js: -------------------------------------------------------------------------------- 1 | var express = require("express"); 2 | var app = express(); 3 | 4 | app.set("port", process.env.PORT || 3000); 5 | 6 | app.get("/", function(req, res) { 7 | res.send("Hello world!"); 8 | }); 9 | 10 | app.listen(app.get("port"), function() { 11 | console.log("App running on port " + app.get("port")); 12 | }); 13 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_11/heroku-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "start": "node app", 5 | "production": "forever app.js" 6 | }, 7 | "dependencies": { 8 | "express": "5.0.0-alpha.2", 9 | "forever": "^0.13.0" 10 | }, 11 | "engines": { 12 | "node": "0.10.x" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_12/express-generated-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "express-generated-app", 3 | "version": "0.0.0", 4 | "private": true, 5 | "scripts": { 6 | "start": "node ./bin/www" 7 | }, 8 | "dependencies": { 9 | "body-parser": "~1.12.0", 10 | "cookie-parser": "~1.3.4", 11 | "debug": "~2.1.1", 12 | "express": "~4.12.2", 13 | "jade": "~1.9.2", 14 | "morgan": "~1.5.1", 15 | "serve-favicon": "~2.2.0" 16 | } 17 | } -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_12/express-generated-app/public/stylesheets/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding: 50px; 3 | font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; 4 | } 5 | 6 | a { 7 | color: #00B7FF; 8 | } -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_12/express-generated-app/routes/index.js: -------------------------------------------------------------------------------- 1 | var express = require('express'); 2 | var router = express.Router(); 3 | 4 | /* GET home page. */ 5 | router.get('/', function(req, res, next) { 6 | res.render('index', { title: 'Express' }); 7 | }); 8 | 9 | module.exports = router; 10 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_12/express-generated-app/routes/users.js: -------------------------------------------------------------------------------- 1 | var express = require('express'); 2 | var router = express.Router(); 3 | 4 | /* GET users listing. */ 5 | router.get('/', function(req, res, next) { 6 | res.send('respond with a resource'); 7 | }); 8 | 9 | module.exports = router; 10 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_12/express-generated-app/views/error.jade: -------------------------------------------------------------------------------- 1 | extends layout 2 | 3 | block content 4 | h1= message 5 | h2= error.status 6 | pre #{error.stack} 7 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_12/express-generated-app/views/index.jade: -------------------------------------------------------------------------------- 1 | extends layout 2 | 3 | block content 4 | h1= title 5 | p Welcome to #{title} 6 | -------------------------------------------------------------------------------- /_old/typed-express-in-action/Chapter_12/express-generated-app/views/layout.jade: -------------------------------------------------------------------------------- 1 | doctype html 2 | html 3 | head 4 | title= title 5 | link(rel='stylesheet', href='/stylesheets/style.css') 6 | body 7 | block content -------------------------------------------------------------------------------- /step00_helloworld/app.js: -------------------------------------------------------------------------------- 1 | console.log(helloWorldFn()); 2 | function helloWorldFn() { 3 | return "Hello World"; 4 | } 5 | -------------------------------------------------------------------------------- /step00_helloworld/app.ts: -------------------------------------------------------------------------------- 1 | 2 | console.log(helloWorldFn()) 3 | 4 | function helloWorldFn(){ 5 | return "Hello World" 6 | } -------------------------------------------------------------------------------- /step00_helloworld/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Hello-World", 3 | "version" : "1.0.0", 4 | "private": true, 5 | "scripts": { 6 | "start": "node app" 7 | }, 8 | "dependencies": { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /step00_helloworld/readme.md: -------------------------------------------------------------------------------- 1 | Listing 1.1 “Hello World” in Express in TypeScript from the Book Express in Action: 2 | 3 | https://www.manning.com/books/express-in-action 4 | 5 | 6 | Express 5 Update: 7 | http://expressjs.com/guide/migrating-5.html 8 | 9 | 10 | ## To run this project: 11 | open terminal in this directory and write command 12 | 1) `tsc app.ts` to transpile the project 13 | 2) `npm start` to run project -------------------------------------------------------------------------------- /step01_chapter01_what_is_express/express_hello_world/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /step01_chapter01_what_is_express/express_hello_world/app.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | exports.__esModule = true; 3 | var express = require("express"); 4 | var app = express(); 5 | app.get("/", function (request, response) { 6 | response.send("Hello world!"); 7 | }); 8 | app.listen(3000, function () { 9 | console.log("Express app started on port 3000."); 10 | }); 11 | -------------------------------------------------------------------------------- /step01_chapter01_what_is_express/express_hello_world/app.ts: -------------------------------------------------------------------------------- 1 | import * as express from "express"; 2 | 3 | let app = express(); 4 | 5 | app.get("/", (request, response) => { 6 | response.send("Hello world!"); 7 | }); 8 | 9 | app.listen(3000, () => { 10 | console.log("Express app started on port 3000."); 11 | }); -------------------------------------------------------------------------------- /step01_chapter01_what_is_express/express_hello_world/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "start": "node app" 5 | }, 6 | "dependencies": { 7 | "@types/express": "^4.16.0", 8 | "express": "^5.0.0-alpha.6" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /step01_chapter01_what_is_express/express_hello_world/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /step02_chapter02_the_basics_of_node.js/built_in_modules/app.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | exports.__esModule = true; 3 | var url = require("url"); 4 | var parsedURL = url.parse("http://www.example.com/profile?name=barry"); 5 | console.log(parsedURL.protocol); // "http:" 6 | console.log(parsedURL.host); // "www.example.com" 7 | console.log(parsedURL.query); // "name=barry" 8 | -------------------------------------------------------------------------------- /step02_chapter02_the_basics_of_node.js/built_in_modules/app.ts: -------------------------------------------------------------------------------- 1 | 2 | import * as url from "url" 3 | 4 | var parsedURL = url.parse("http://www.example.com/profile?name=barry"); 5 | console.log(parsedURL.protocol); // "http:" 6 | console.log(parsedURL.host); // "www.example.com" 7 | console.log(parsedURL.query);// "name=barry" 8 | -------------------------------------------------------------------------------- /step02_chapter02_the_basics_of_node.js/built_in_modules/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "requires": true, 3 | "lockfileVersion": 1, 4 | "dependencies": { 5 | "@types/node": { 6 | "version": "10.7.1", 7 | "resolved": "https://registry.npmjs.org/@types/node/-/node-10.7.1.tgz", 8 | "integrity": "sha512-EGoI4ylB/lPOaqXqtzAyL8HcgOuCtH2hkEaLmkueOYufsTFWBn4VCvlCDC2HW8Q+9iF+QVC3sxjDKQYjHQeZ9w==" 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /step02_chapter02_the_basics_of_node.js/built_in_modules/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "start": "node app" 5 | }, 6 | "dependencies": { 7 | "@types/node": "^10.7.1" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /step02_chapter02_the_basics_of_node.js/built_in_modules/readme.md: -------------------------------------------------------------------------------- 1 | Listing 2.2 Requiring Node's URL module in TypeScript from the Book Express in Action: 2 | 3 | https://www.manning.com/books/express-in-action 4 | 5 | 6 | ### to run this project: 7 | 8 | open terminal in this directory and write command: 9 | 1) `npm install` to install all dependencies listed in packege.json/packege-lock.json 10 | 2) `tsc app.ts` to transpile the project 11 | 3) `npm start` to run project 12 | -------------------------------------------------------------------------------- /step02_chapter02_the_basics_of_node.js/built_in_modules/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /step02_chapter02_the_basics_of_node.js/defining_modules_es2015/app.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var my_module_1 = require("./my-module"); 4 | console.log(my_module_1.randomInteger(100)); 5 | console.log(my_module_1.randomInteger(100)); 6 | console.log(my_module_1.randomInteger(100)); 7 | -------------------------------------------------------------------------------- /step02_chapter02_the_basics_of_node.js/defining_modules_es2015/app.ts: -------------------------------------------------------------------------------- 1 | 2 | import { randomInteger } from "./my-module"; 3 | 4 | console.log(randomInteger(100)); 5 | console.log(randomInteger(100)); 6 | console.log(randomInteger(100)); -------------------------------------------------------------------------------- /step02_chapter02_the_basics_of_node.js/defining_modules_es2015/my-module.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | function randomInteger(MAX) { 4 | return Math.floor((Math.random() * MAX)); 5 | } 6 | exports.randomInteger = randomInteger; 7 | -------------------------------------------------------------------------------- /step02_chapter02_the_basics_of_node.js/defining_modules_es2015/my-module.ts: -------------------------------------------------------------------------------- 1 | 2 | export function randomInteger(MAX: number): number { 3 | return Math.floor((Math.random() * MAX)); 4 | } 5 | -------------------------------------------------------------------------------- /step02_chapter02_the_basics_of_node.js/defining_modules_es2015/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "start": "node app" 5 | }, 6 | "dependencies": { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /step02_chapter02_the_basics_of_node.js/defining_modules_es2015/readme.md: -------------------------------------------------------------------------------- 1 | Listing 2.9 and 2.10 in TypeScript from the Book Express in Action: 2 | 3 | https://www.manning.com/books/express-in-action 4 | 5 | The TypeScript Version uses ES2015 (ES6) Module Syntax: 6 | 7 | http://www.2ality.com/2014/09/es6-modules-final.html 8 | 9 | 10 | 11 | ### To run this project: 12 | 13 | open terminal in this directory and write command: 14 | - `tsc` to transpile all .ts files in the project 15 | - `npm start` to run project 16 | -------------------------------------------------------------------------------- /step02_chapter02_the_basics_of_node.js/defining_modules_es2015/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /step02_chapter02_the_basics_of_node.js/node_hello_world/app.js: -------------------------------------------------------------------------------- 1 | console.log("Hello World!"); 2 | -------------------------------------------------------------------------------- /step02_chapter02_the_basics_of_node.js/node_hello_world/app.ts: -------------------------------------------------------------------------------- 1 | console.log("Hello World!"); -------------------------------------------------------------------------------- /step02_chapter02_the_basics_of_node.js/node_hello_world/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "start": "node app" 5 | }, 6 | "dependencies": { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /step02_chapter02_the_basics_of_node.js/node_hello_world/readme.md: -------------------------------------------------------------------------------- 1 | Express 5 Update: 2 | http://expressjs.com/guide/migrating-5.html 3 | 4 | 5 | 6 | ### To run this project: 7 | 8 | open terminal in this directory and write command: 9 | - `tsc` to transpile all .ts files in the project 10 | - `npm start` to run project -------------------------------------------------------------------------------- /step02_chapter02_the_basics_of_node.js/node_hello_world/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /step02_chapter02_the_basics_of_node.js/node_webserver/app.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var http_1 = require("http"); 4 | function requestHandler(request, response) { 5 | console.log("In comes a request to: " + request.url); 6 | response.end("Hello, world!"); 7 | } 8 | var server = http_1.createServer(requestHandler); 9 | server.listen(3000, function () { 10 | console.log("listening on port 3000"); 11 | }); 12 | -------------------------------------------------------------------------------- /step02_chapter02_the_basics_of_node.js/node_webserver/app.ts: -------------------------------------------------------------------------------- 1 | 2 | import { Server, createServer, IncomingMessage, ServerResponse } from "http"; 3 | 4 | 5 | function requestHandler(request: IncomingMessage, response: ServerResponse) { 6 | 7 | console.log("In comes a request to: " + request.url); 8 | response.end("Hello, world!"); 9 | } 10 | 11 | 12 | var server: Server = createServer(requestHandler); 13 | 14 | server.listen(3000, () => { 15 | console.log("listening on port 3000") 16 | }); -------------------------------------------------------------------------------- /step02_chapter02_the_basics_of_node.js/node_webserver/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "requires": true, 3 | "lockfileVersion": 1, 4 | "dependencies": { 5 | "@types/node": { 6 | "version": "10.7.1", 7 | "resolved": "https://registry.npmjs.org/@types/node/-/node-10.7.1.tgz", 8 | "integrity": "sha512-EGoI4ylB/lPOaqXqtzAyL8HcgOuCtH2hkEaLmkueOYufsTFWBn4VCvlCDC2HW8Q+9iF+QVC3sxjDKQYjHQeZ9w==" 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /step02_chapter02_the_basics_of_node.js/node_webserver/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "start": "node app" 5 | }, 6 | "dependencies": { 7 | "@types/node": "^10.7.1" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /step02_chapter02_the_basics_of_node.js/node_webserver/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /step02_chapter02_the_basics_of_node.js/node_webserver_routing/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "requires": true, 3 | "lockfileVersion": 1, 4 | "dependencies": { 5 | "@types/node": { 6 | "version": "10.7.1", 7 | "resolved": "https://registry.npmjs.org/@types/node/-/node-10.7.1.tgz", 8 | "integrity": "sha512-EGoI4ylB/lPOaqXqtzAyL8HcgOuCtH2hkEaLmkueOYufsTFWBn4VCvlCDC2HW8Q+9iF+QVC3sxjDKQYjHQeZ9w==" 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /step02_chapter02_the_basics_of_node.js/node_webserver_routing/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "start": "node app" 5 | }, 6 | "dependencies": { 7 | "@types/node": "^10.7.1" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /step02_chapter02_the_basics_of_node.js/node_webserver_routing/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /step02_chapter02_the_basics_of_node.js/reading_file_async/app.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var fs_1 = require("fs"); 4 | var options = { encoding: "utf-8" }; 5 | fs_1.readFile("myfile.txt", options, function (err, data) { 6 | if (err) { 7 | console.error("Error reading file!"); 8 | return; 9 | } 10 | console.log(data.match(/x/gi).length + " letter X's"); 11 | }); 12 | console.log("Hello world!"); 13 | -------------------------------------------------------------------------------- /step02_chapter02_the_basics_of_node.js/reading_file_async/app.ts: -------------------------------------------------------------------------------- 1 | import { readFile } from "fs"; 2 | 3 | const options = { encoding: "utf-8" }; 4 | 5 | readFile("myfile.txt", options, (err, data) => { 6 | if (err) { 7 | console.error("Error reading file!"); 8 | return; 9 | } 10 | console.log(data.match(/x/gi).length + " letter X's"); 11 | }); 12 | 13 | console.log("Hello world!"); 14 | -------------------------------------------------------------------------------- /step02_chapter02_the_basics_of_node.js/reading_file_async/myfile.txt: -------------------------------------------------------------------------------- 1 | x = a + b; -------------------------------------------------------------------------------- /step02_chapter02_the_basics_of_node.js/reading_file_async/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "requires": true, 3 | "lockfileVersion": 1, 4 | "dependencies": { 5 | "@types/node": { 6 | "version": "10.7.1", 7 | "resolved": "https://registry.npmjs.org/@types/node/-/node-10.7.1.tgz", 8 | "integrity": "sha512-EGoI4ylB/lPOaqXqtzAyL8HcgOuCtH2hkEaLmkueOYufsTFWBn4VCvlCDC2HW8Q+9iF+QVC3sxjDKQYjHQeZ9w==" 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /step02_chapter02_the_basics_of_node.js/reading_file_async/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "start": "node app" 5 | }, 6 | "dependencies": { 7 | "@types/node": "^10.7.1" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /step02_chapter02_the_basics_of_node.js/reading_file_async/readme.md: -------------------------------------------------------------------------------- 1 | Listing 2.11 and 2.12 in TypeScript from the Book Express in Action: 2 | 3 | https://www.manning.com/books/express-in-action 4 | 5 | 6 | ### To run this project: 7 | 8 | open terminal in this directory and write command: 9 | - `npm install` to install all dependencies listed in packege.json/packege-lock.json 10 | - `tsc` to transpile all .ts files in the project 11 | - `npm start` to run project -------------------------------------------------------------------------------- /step02_chapter02_the_basics_of_node.js/reading_file_async/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /step02_chapter02_the_basics_of_node.js/third_party_modules/app.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var mustache_1 = require("mustache"); 4 | var result = mustache_1.render("Hi, {{first}} {{last}}!", { 5 | first: "Nicolas", 6 | last: "Cage" 7 | }); 8 | console.log(result); 9 | -------------------------------------------------------------------------------- /step02_chapter02_the_basics_of_node.js/third_party_modules/app.ts: -------------------------------------------------------------------------------- 1 | 2 | import { render } from "mustache"; 3 | 4 | let result = render("Hi, {{first}} {{last}}!", { 5 | first: "Nicolas", 6 | last: "Cage" 7 | }); 8 | 9 | console.log(result); -------------------------------------------------------------------------------- /step02_chapter02_the_basics_of_node.js/third_party_modules/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "start": "node app" 5 | }, 6 | "dependencies": { 7 | "@types/mustache": "^0.8.31", 8 | "mustache": "^2.3.2" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /step02_chapter02_the_basics_of_node.js/third_party_modules/readme.md: -------------------------------------------------------------------------------- 1 | Listing 2.7 Using the Mustache module in TypeScript from the Book Express in Action: 2 | 3 | https://www.manning.com/books/express-in-action 4 | 5 | 6 | 7 | ### To run this project: 8 | 9 | open terminal in this directory and write command: 10 | - `npm install` to install all dependencies listed in packege.json/packege-lock.json 11 | - `tsc` to transpile all .ts files in the project 12 | - `npm start` to run project -------------------------------------------------------------------------------- /step02_chapter02_the_basics_of_node.js/third_party_modules/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /step03_chapter03_foundations_of_express/guestbook/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /step03_chapter03_foundations_of_express/guestbook/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Hello World 8 | 9 | 10 | -------------------------------------------------------------------------------- /step03_chapter03_foundations_of_express/guestbook/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "express-guestbook", 3 | "private": true, 4 | "scripts": { 5 | "start": "node app" 6 | }, 7 | "dependencies": { 8 | "@types/body-parser": "^1.17.0", 9 | "@types/express": "^4.16.0", 10 | "@types/morgan": "^1.7.35", 11 | "@types/node": "^10.7.1", 12 | "body-parser": "^1.18.3", 13 | "ejs": "^2.6.1", 14 | "express": "^5.0.0-alpha.6", 15 | "morgan": "^1.9.0" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /step03_chapter03_foundations_of_express/guestbook/readme.md: -------------------------------------------------------------------------------- 1 | Listing 3.19 to 3.25 in TypeScript from the Book Express in Action: 2 | 3 | https://www.manning.com/books/express-in-action 4 | 5 | 6 | ### To run this project: 7 | 8 | open terminal in this directory and write command: 9 | - `npm install` to install all dependencies listed in packege.json/packege-lock.json 10 | - `tsc` to transpile all .ts files in the project 11 | - `npm start` to run project 12 | - open http://localhost:3000 to see the result -------------------------------------------------------------------------------- /step03_chapter03_foundations_of_express/guestbook/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /step03_chapter03_foundations_of_express/guestbook/views/404.ejs: -------------------------------------------------------------------------------- 1 | <% include header %> 2 |

404! Page not found.

3 | <% include footer %> -------------------------------------------------------------------------------- /step03_chapter03_foundations_of_express/guestbook/views/footer.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /step03_chapter03_foundations_of_express/guestbook/views/header.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Express Guestbook 6 | 7 | 8 | 9 |

10 | Express Guestbook 11 | 12 | Write in the guestbook 13 | 14 |

15 | -------------------------------------------------------------------------------- /step03_chapter03_foundations_of_express/hello-world/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /step03_chapter03_foundations_of_express/hello-world/app-simple.js: -------------------------------------------------------------------------------- 1 | /// 2 | var express = require("express"); 3 | var http = require("http"); 4 | var app = express(); 5 | app.use(function (request, response) { 6 | response.writeHead(200, { "Content-Type": "text/plain" }); 7 | response.end("Hello, World!"); 8 | }); 9 | http.createServer(app).listen(3000); 10 | -------------------------------------------------------------------------------- /step03_chapter03_foundations_of_express/hello-world/app-simple.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import express = require("express"); 4 | import http = require("http"); 5 | 6 | var app = express(); 7 | 8 | app.use((request: express.Request, response: express.Response) => { 9 | response.writeHead(200, { "Content-Type": "text/plain" }); 10 | response.end("Hello, World!"); 11 | }); 12 | 13 | http.createServer(app).listen(3000); 14 | -------------------------------------------------------------------------------- /step03_chapter03_foundations_of_express/hello-world/cool-facts.txt: -------------------------------------------------------------------------------- 1 | - dogs are cool 2 | - cats are cool 3 | - ??? 4 | -------------------------------------------------------------------------------- /step03_chapter03_foundations_of_express/hello-world/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "name": "chapter3", 4 | "version": "1", 5 | "scripts": { 6 | "start": "node app", 7 | "tsc": "tsc --module commonjs -p ." 8 | }, 9 | "dependencies": { 10 | "express": "^5.0.0-alpha.2", 11 | "morgan": "^1.6.1" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /step03_chapter03_foundations_of_express/hello-world/readme.md: -------------------------------------------------------------------------------- 1 | Chapter 3 code in TypeScript from the Book Express in Action: 2 | 3 | https://www.manning.com/books/express-in-action -------------------------------------------------------------------------------- /step03_chapter03_foundations_of_express/hello-world/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /step03_chapter03_foundations_of_express/routing/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /step03_chapter03_foundations_of_express/routing/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "start": "node app" 5 | }, 6 | "dependencies": { 7 | "express": "^5.0.0-alpha.2", 8 | "morgan": "^1.6.1" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /step03_chapter03_foundations_of_express/routing/public/file.txt: -------------------------------------------------------------------------------- 1 | This is a sample static file! 2 | -------------------------------------------------------------------------------- /step03_chapter03_foundations_of_express/routing/readme.md: -------------------------------------------------------------------------------- 1 | Listing 3.10 Express routing example in TypeScript from the Book Express in Action: 2 | 3 | https://www.manning.com/books/express-in-action -------------------------------------------------------------------------------- /step03_chapter03_foundations_of_express/routing/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /step03_chapter03_foundations_of_express/statics/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /step03_chapter03_foundations_of_express/statics/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "start": "node app" 5 | }, 6 | "dependencies": { 7 | "express": "^5.0.0-alpha.2", 8 | "morgan": "^1.6.1" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /step03_chapter03_foundations_of_express/statics/public/file.txt: -------------------------------------------------------------------------------- 1 | This is a sample static file! 2 | -------------------------------------------------------------------------------- /step03_chapter03_foundations_of_express/statics/readme.md: -------------------------------------------------------------------------------- 1 | Listing 3.9 Using express.static in TypeScript from the Book Express in Action: 2 | 3 | https://www.manning.com/books/express-in-action -------------------------------------------------------------------------------- /step03_chapter03_foundations_of_express/statics/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /step03_chapter03_foundations_of_express/views-example/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /step03_chapter03_foundations_of_express/views-example/app.js: -------------------------------------------------------------------------------- 1 | /// 2 | var express = require("express"); 3 | var http = require("http"); 4 | var path = require("path"); 5 | var app = express(); 6 | app.set("views", path.resolve(__dirname, "views")); 7 | app.set("view engine", "ejs"); 8 | app.get("/", function (request, response) { 9 | response.render("index", { 10 | message: "Hey everyone! This is my webpage." 11 | }); 12 | }); 13 | http.createServer(app).listen(3000); 14 | -------------------------------------------------------------------------------- /step03_chapter03_foundations_of_express/views-example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "start": "node app" 5 | }, 6 | "dependencies": { 7 | "ejs": "^2.3.3", 8 | "express": "^5.0.0-alpha.2", 9 | "morgan": "^1.6.1" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /step03_chapter03_foundations_of_express/views-example/readme.md: -------------------------------------------------------------------------------- 1 | Listing 3.15, 3.16, 3.17, and 3.18 in TypeScript from the Book Express in Action: 2 | 3 | https://www.manning.com/books/express-in-action -------------------------------------------------------------------------------- /step03_chapter03_foundations_of_express/views-example/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /step03_chapter03_foundations_of_express/views-example/views/index.ejs: -------------------------------------------------------------------------------- 1 | Hello, world <%= message %> -------------------------------------------------------------------------------- /step04_chapter04_middleware/error-stack/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /step04_chapter04_middleware/error-stack/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "start": "node app" 5 | }, 6 | "dependencies": { 7 | "express": "^5.0.0-alpha.2", 8 | "morgan": "^1.6.1" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /step04_chapter04_middleware/error-stack/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /step04_chapter04_middleware/static-file-fun/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /step04_chapter04_middleware/static-file-fun/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "start": "node app" 5 | }, 6 | "dependencies": { 7 | "express": "^5.0.0-alpha.2", 8 | "morgan": "^1.6.1" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /step04_chapter04_middleware/static-file-fun/static/hello.txt: -------------------------------------------------------------------------------- 1 | Hello World! -------------------------------------------------------------------------------- /step04_chapter04_middleware/static-file-fun/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /step05_chapter05_routing/temperature-by-zip-code/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /step05_chapter05_routing/temperature-by-zip-code/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "temperature-by-zip", 3 | "private": true, 4 | "scripts": { 5 | "start": "node app.js" 6 | }, 7 | "dependencies": { 8 | "ejs": "^2.3.1", 9 | "express": "5.0.0-alpha.2", 10 | "forecastio": "^0.2.0", 11 | "zippity-do-dah": "0.0.x" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /step05_chapter05_routing/temperature-by-zip-code/public/the.css: -------------------------------------------------------------------------------- 1 | html { 2 | display: table; 3 | width: 100%; 4 | height: 100%; 5 | } 6 | body { 7 | display: table-cell; 8 | vertical-align: middle; 9 | text-align: center; 10 | } 11 | -------------------------------------------------------------------------------- /step05_chapter05_routing/temperature-by-zip-code/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /step05_chapter05_routing/temperature-by-zip-code/views/404.ejs: -------------------------------------------------------------------------------- 1 | <% include header %> 2 | 3 |

404 error! File not found.

4 | 5 | <% include footer %> 6 | -------------------------------------------------------------------------------- /step05_chapter05_routing/temperature-by-zip-code/views/footer.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /step05_chapter05_routing/temperature-by-zip-code/views/header.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Temperature by ZIP code 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /step05_chapter05_routing/temperature-by-zip-code/views/index.ejs: -------------------------------------------------------------------------------- 1 | <% include header %> 2 | 3 |

What's your ZIP code?

4 | 5 |
6 |
7 | 8 | 9 |
10 |
11 | 12 | 13 | 14 | 15 | <% include footer %> 16 | -------------------------------------------------------------------------------- /step06_chapter06_building_APIs/random-number-api/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /step06_chapter06_building_APIs/random-number-api/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "random-number-api", 3 | "private": true, 4 | "scripts": { 5 | "start": "node app" 6 | }, 7 | "dependencies": { 8 | "express": "5.0.0-alpha.2" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /step06_chapter06_building_APIs/random-number-api/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /step07_views_ejs/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /step07_views_ejs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "random-number-api", 3 | "private": true, 4 | "scripts": { 5 | "start": "node app" 6 | }, 7 | "dependencies": { 8 | "ejs": "^2.3.4", 9 | "express": "5.0.0-alpha.2" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /step07_views_ejs/public/img/typescript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/panacloud/learn-typed-express/abae539066747ea9a5afdd34ed137443ea1cb4cd/step07_views_ejs/public/img/typescript.png -------------------------------------------------------------------------------- /step07_views_ejs/readme.md: -------------------------------------------------------------------------------- 1 | # ejs: 2 | Embedded JavaScript templates 3 | 4 | - Control flow with <% %> 5 | - Escaped output with <%= %> 6 | - Unescaped raw output with <%- %> 7 | - Includes 8 | 9 | Usage: 10 | 11 | - <% 'Scriptlet' tag, for control-flow, no output 12 | - <%= Outputs the value into the template (HTML escaped) 13 | - <%- Outputs the unescaped value into the template 14 | - <%# Comment tag, no execution, no output 15 | - %> Plain ending tag -------------------------------------------------------------------------------- /step07_views_ejs/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /step07_views_ejs/views/partial.ejs: -------------------------------------------------------------------------------- 1 |
2 |

Partial EJS to include

3 |
-------------------------------------------------------------------------------- /step08_chapter08_MongoDB/learn-about-me/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/learn-about-me/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "learn-about-me", 3 | "private": true, 4 | "scripts": { 5 | "start": "node app" 6 | }, 7 | "dependencies": { 8 | "bcrypt-nodejs": "0.0.3", 9 | "body-parser": "^1.6.5", 10 | "connect-flash": "^0.1.1", 11 | "cookie-parser": "^1.3.2", 12 | "ejs": "^1.0.0", 13 | "express": "5.0.0-alpha.2", 14 | "express-session": "^1.7.6", 15 | "mongoose": "^3.8.15", 16 | "passport": "^0.2.0", 17 | "passport-local": "^1.0.0" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/learn-about-me/random-number-api/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/learn-about-me/random-number-api/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "random-number-api", 3 | "private": true, 4 | "scripts": { 5 | "start": "node app" 6 | }, 7 | "dependencies": { 8 | "express": "5.0.0-alpha.2" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/learn-about-me/random-number-api/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/learn-about-me/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/learn-about-me/views/_footer.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/learn-about-me/views/edit.ejs: -------------------------------------------------------------------------------- 1 | <% include _header %> 2 | 3 |

Edit your profile

4 | 5 |
6 | "> 7 | 8 | 9 |
10 | 11 | <% include _footer %> 12 | -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/learn-about-me/views/index.ejs: -------------------------------------------------------------------------------- 1 | <% include _header %> 2 | 3 |

Welcome to Learn About Me!

4 | 5 | <% users.forEach(function(user) { %> 6 | 7 |
8 | 13 | <% if (user.bio) { %> 14 |
<%= user.bio %>
15 | <% } %> 16 |
17 | 18 | <% }) %> 19 | 20 | <% include _footer %> 21 | -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/learn-about-me/views/login.ejs: -------------------------------------------------------------------------------- 1 | <% include _header %> 2 | 3 |

Log in

4 | 5 |
6 | 7 | 8 | 9 |
10 | 11 | <% include _footer %> 12 | -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/learn-about-me/views/profile.ejs: -------------------------------------------------------------------------------- 1 | <% include _header %> 2 | 3 | <% if ((currentUser) && (currentUser.id === user.id)) { %> 4 | Edit your profile 5 | <% } %> 6 | 7 |

<%= user.name() %>

8 |

Joined on <%= user.createdAt %>

9 | 10 | <% if (user.bio) { %> 11 |

<%= user.bio %>

12 | <% } %> 13 | 14 | <% include _footer %> 15 | -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/learn-about-me/views/signup.ejs: -------------------------------------------------------------------------------- 1 | <% include _header %> 2 | 3 |

Sign up

4 | 5 |
6 | 7 | 8 | 9 |
10 | 11 | <% include _footer %> 12 | -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic/IUserModel.js: -------------------------------------------------------------------------------- 1 | ; 2 | -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic/IUserModel.ts: -------------------------------------------------------------------------------- 1 | import mongoose = require("mongoose"); 2 | import {IUser} from "./shared/IUser"; 3 | 4 | export interface IUserModel extends IUser, mongoose.Document { 5 | 6 | }; -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic/User.js: -------------------------------------------------------------------------------- 1 | /// 2 | var mongoose = require("mongoose"); 3 | var userSchema = new mongoose.Schema({ 4 | email: { type: String, required: true, unique: true }, 5 | password: { type: String, required: true }, 6 | displayName: String 7 | }); 8 | var User = mongoose.model("User", userSchema); 9 | exports["default"] = User; 10 | -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic/User.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import mongoose = require("mongoose"); 4 | import { IUserModel } from "./IUserModel"; 5 | 6 | 7 | var userSchema = new mongoose.Schema({ 8 | email: { type: String, required: true, unique: true }, 9 | password: { type: String, required: true}, 10 | displayName: String 11 | }); 12 | 13 | var User = mongoose.model("User", userSchema); 14 | 15 | export default User; 16 | 17 | -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "HelloWorld", 3 | "version": "1.0.0", 4 | "private": true, 5 | "scripts": { 6 | "start": "node app" 7 | }, 8 | "dependencies": { 9 | "mongoose": "^4.3.4" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic/readme.md: -------------------------------------------------------------------------------- 1 | When sharing models between client and server is required: 2 | 3 | 4 | https://github.com/Appsilon/styleguide/wiki/mongoose-typescript-models 5 | 6 | Note: Read the book Mongoose for Application Development: 7 | https://www.ebooks-it.net/ebook/mongoose-for-application-development -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic/shared/IUser.js: -------------------------------------------------------------------------------- 1 | ; 2 | -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic/shared/IUser.ts: -------------------------------------------------------------------------------- 1 | export interface IUser { 2 | email: string; 3 | password: string; 4 | displayName: string; 5 | }; -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "module": "commonjs" 5 | }, 6 | "files": [ 7 | "app.ts", 8 | "User.ts", 9 | "./shared/IUser.ts" 10 | ] 11 | } -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic2/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic2/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "HelloWorld", 3 | "version": "1.0.0", 4 | "private": true, 5 | "scripts": { 6 | "start": "node app" 7 | }, 8 | "dependencies": { 9 | "mongoose": "^4.3.4" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic2/readme.md: -------------------------------------------------------------------------------- 1 | When sharing models between client and server is not required: 2 | 3 | https://gist.github.com/masahirompp/3c012c8721b70821fa45 4 | 5 | Note: Read the book Mongoose for Application Development: 6 | https://www.ebooks-it.net/ebook/mongoose-for-application-development -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic2/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "module": "commonjs" 5 | }, 6 | "files": [ 7 | "app.ts" 8 | ] 9 | } -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic3/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic3/IProjectModel.js: -------------------------------------------------------------------------------- 1 | ; 2 | -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic3/IProjectModel.ts: -------------------------------------------------------------------------------- 1 | import mongoose = require("mongoose"); 2 | import {IProject} from "./shared/IProject"; 3 | 4 | export interface IProjectModel extends IProject, mongoose.Document { 5 | 6 | }; -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic3/IUserModel.js: -------------------------------------------------------------------------------- 1 | ; 2 | -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic3/IUserModel.ts: -------------------------------------------------------------------------------- 1 | import mongoose = require("mongoose"); 2 | import {IUser} from "./shared/IUser"; 3 | 4 | export interface IUserModel extends IUser, mongoose.Document { 5 | 6 | }; -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic3/Project.js: -------------------------------------------------------------------------------- 1 | /// 2 | var mongoose = require("mongoose"); 3 | var projectSchema = new mongoose.Schema({ 4 | name: { type: String, required: true }, 5 | createdBy: { ref: 'User', type: mongoose.Schema.Types.ObjectId } 6 | }); 7 | var Project = mongoose.model("Project", projectSchema); 8 | exports["default"] = Project; 9 | -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic3/Project.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import mongoose = require("mongoose"); 4 | import { IProjectModel } from "./IProjectModel"; 5 | 6 | 7 | var projectSchema = new mongoose.Schema({ 8 | name: { type: String, required: true }, 9 | createdBy : { ref : 'User', type: mongoose.Schema.Types.ObjectId} 10 | }); 11 | 12 | 13 | var Project = mongoose.model("Project", projectSchema); 14 | 15 | export default Project; 16 | 17 | -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic3/User.js: -------------------------------------------------------------------------------- 1 | /// 2 | var mongoose = require("mongoose"); 3 | var userSchema = new mongoose.Schema({ 4 | email: { type: String, required: true }, 5 | password: { type: String, required: true }, 6 | displayName: String 7 | }); 8 | var User = mongoose.model("User", userSchema, 'myUserCol'); 9 | exports["default"] = User; 10 | -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic3/User.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import mongoose = require("mongoose"); 4 | import { IUserModel } from "./IUserModel"; 5 | 6 | 7 | var userSchema = new mongoose.Schema({ 8 | email: { type: String, required: true }, 9 | password: { type: String, required: true}, 10 | displayName: String 11 | }); 12 | 13 | 14 | var User = mongoose.model("User", userSchema,'myUserCol'); 15 | 16 | export default User; 17 | 18 | -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic3/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "HelloWorld", 3 | "version": "1.0.0", 4 | "private": true, 5 | "scripts": { 6 | "start": "node app" 7 | }, 8 | "dependencies": { 9 | "mongoose": "^4.3.4" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic3/readme.md: -------------------------------------------------------------------------------- 1 | When sharing models between client and server is required: 2 | 3 | 4 | https://github.com/Appsilon/styleguide/wiki/mongoose-typescript-models 5 | 6 | Note: Read the book Mongoose for Application Development: 7 | https://www.ebooks-it.net/ebook/mongoose-for-application-development -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic3/shared/IProject.js: -------------------------------------------------------------------------------- 1 | ; 2 | -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic3/shared/IProject.ts: -------------------------------------------------------------------------------- 1 | import {IUser} from './IUser' 2 | export interface IProject { 3 | name: string; 4 | createdBy : IUser; 5 | }; -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic3/shared/IUser.js: -------------------------------------------------------------------------------- 1 | ; 2 | -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic3/shared/IUser.ts: -------------------------------------------------------------------------------- 1 | export interface IUser { 2 | email: string; 3 | password: string; 4 | displayName: string; 5 | }; -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic3/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "module": "commonjs" 5 | }, 6 | "files": [ 7 | "app.ts", 8 | "User.ts", 9 | "Project.ts", 10 | "./shared/IUser.ts", 11 | "./shared/IProject.ts" 12 | ] 13 | } -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic4/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic4/IProjectModel.js: -------------------------------------------------------------------------------- 1 | ; 2 | -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic4/IProjectModel.ts: -------------------------------------------------------------------------------- 1 | import mongoose = require("mongoose"); 2 | import {IProject} from "./shared/IProject"; 3 | 4 | export interface IProjectModel extends IProject, mongoose.Document { 5 | 6 | }; -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic4/IUserModel.js: -------------------------------------------------------------------------------- 1 | ; 2 | -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic4/IUserModel.ts: -------------------------------------------------------------------------------- 1 | import mongoose = require("mongoose"); 2 | import {IUser} from "./shared/IUser"; 3 | 4 | export interface IUserModel extends IUser, mongoose.Document { 5 | 6 | }; -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic4/Project.js: -------------------------------------------------------------------------------- 1 | /// 2 | var mongoose = require("mongoose"); 3 | var projectSchema = new mongoose.Schema({ 4 | name: { type: String, required: true }, 5 | createdBy: [{ ref: 'User', type: mongoose.Schema.Types.ObjectId }] 6 | }); 7 | var Project = mongoose.model("Project", projectSchema); 8 | exports["default"] = Project; 9 | -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic4/Project.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import mongoose = require("mongoose"); 4 | import { IProjectModel } from "./IProjectModel"; 5 | 6 | 7 | var projectSchema = new mongoose.Schema({ 8 | name: { type: String, required: true }, 9 | createdBy : [{ ref : 'User', type: mongoose.Schema.Types.ObjectId}] 10 | }); 11 | 12 | 13 | var Project = mongoose.model("Project", projectSchema); 14 | 15 | export default Project; 16 | 17 | -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic4/User.js: -------------------------------------------------------------------------------- 1 | /// 2 | var mongoose = require("mongoose"); 3 | var userSchema = new mongoose.Schema({ 4 | email: { type: String, required: true }, 5 | password: { type: String, required: true }, 6 | displayName: String, 7 | projects: [{ ref: 'Project', type: mongoose.Schema.Types.ObjectId }] 8 | }); 9 | var User = mongoose.model("User", userSchema); 10 | exports["default"] = User; 11 | -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic4/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "HelloWorld", 3 | "version": "1.0.0", 4 | "private": true, 5 | "scripts": { 6 | "start": "node app" 7 | }, 8 | "dependencies": { 9 | "mongoose": "^4.3.4" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic4/readme.md: -------------------------------------------------------------------------------- 1 | When sharing models between client and server is required: 2 | 3 | 4 | https://github.com/Appsilon/styleguide/wiki/mongoose-typescript-models 5 | 6 | Note: Read the book Mongoose for Application Development: 7 | https://www.ebooks-it.net/ebook/mongoose-for-application-development -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic4/shared/IProject.js: -------------------------------------------------------------------------------- 1 | ; 2 | -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic4/shared/IProject.ts: -------------------------------------------------------------------------------- 1 | import {IUser} from './IUser' 2 | export interface IProject { 3 | name: string; 4 | createdBy : IUser[]; 5 | }; -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic4/shared/IUser.js: -------------------------------------------------------------------------------- 1 | ; 2 | -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic4/shared/IUser.ts: -------------------------------------------------------------------------------- 1 | import {IProject} from './IProject' 2 | export interface IUser { 3 | email: string; 4 | password: string; 5 | displayName: string; 6 | projects : IProject[]; 7 | }; -------------------------------------------------------------------------------- /step08_chapter08_MongoDB/typed_mongoose/basic4/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "module": "commonjs" 5 | }, 6 | "files": [ 7 | "app.ts", 8 | "User.ts", 9 | "Project.ts", 10 | "./shared/IUser.ts", 11 | "./shared/IProject.ts" 12 | ] 13 | } -------------------------------------------------------------------------------- /step09_chapter09_Testing Express Applications/simple_tests/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | *.log 3 | -------------------------------------------------------------------------------- /step09_chapter09_Testing Express Applications/simple_tests/capitalize.js: -------------------------------------------------------------------------------- 1 | function capitalize(str) { 2 | var firstLetter = str.charAt(0).toUpperCase(); 3 | var rest = str.slice(1).toLowerCase(); 4 | return firstLetter + rest; 5 | } 6 | 7 | module.exports = capitalize; 8 | -------------------------------------------------------------------------------- /step09_chapter09_Testing Express Applications/simple_tests/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "devDependencies": { 4 | "chai": "^1.9.2", 5 | "mocha": "^2.0.1" 6 | }, 7 | "scripts": { 8 | "test": "mocha" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /step09_chapter09_Testing Express Applications/simple_tests/test/mocha.opts: -------------------------------------------------------------------------------- 1 | --check-leaks 2 | -------------------------------------------------------------------------------- /step09_chapter09_Testing Express Applications/whats_my_useragent/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | *.log 3 | -------------------------------------------------------------------------------- /step09_chapter09_Testing Express Applications/whats_my_useragent/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "whats-my-user-agent", 3 | "private": true, 4 | "scripts": { 5 | "start": "node app", 6 | "test": "mocha" 7 | }, 8 | "dependencies": { 9 | "ejs": "^1.0.0", 10 | "express": "5.0.0-alpha.1" 11 | }, 12 | "devDependencies": { 13 | "cheerio": "^0.17.0", 14 | "mocha": "^2.0.1", 15 | "supertest": "^0.14.0" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /step09_chapter09_Testing Express Applications/whats_my_useragent/views/index.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 14 | 15 | 16 | 17 | 18 |

Your User Agent is:

19 |

20 | <%= userAgent %> 21 |

22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /step10_chapter10_security/csrf-example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "start": "node app" 5 | }, 6 | "dependencies": { 7 | "body-parser": "^1.10.2", 8 | "csurf": "^1.6.5", 9 | "ejs": "^2.2.3", 10 | "express": "^4.11.1", 11 | "express-session": "^1.10.1" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /step10_chapter10_security/csrf-example/views/index.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | CSRF example 7 | 8 | 9 | 10 | 11 |

CSRF form test

12 | 13 |
14 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /step10_chapter10_security/forever-example/app.js: -------------------------------------------------------------------------------- 1 | var express = require("express"); 2 | 3 | var app = express(); 4 | 5 | app.get("/", function(req, res) { 6 | res.send("Visit /crash to crash the site!"); 7 | }); 8 | 9 | app.get("/crash", function(req, res) { 10 | res.status(500); 11 | res.send("Crashing the site..."); 12 | process.exit(0); 13 | }); 14 | 15 | app.listen(3000, function() { 16 | console.log("App started"); 17 | }); 18 | -------------------------------------------------------------------------------- /step10_chapter10_security/forever-example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "start": "forever app.js" 5 | }, 6 | "dependencies": { 7 | "express": "5.0.0-alpha.2", 8 | "forever": "^0.13.0" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /step10_chapter10_security/print-queries/app.js: -------------------------------------------------------------------------------- 1 | var express = require("express"); 2 | var util = require("util"); 3 | 4 | var app = express(); 5 | 6 | app.set("port", process.env.PORT || 3000); 7 | 8 | app.use(function(req, res) { 9 | res.type("text/plain"); 10 | res.send([ 11 | "req.query looks like this:", 12 | util.inspect(req.query) 13 | ].join("\n\n")); 14 | }); 15 | 16 | app.listen(app.get("port"), function() { 17 | console.log("App started on port " + app.get("port")); 18 | }); 19 | -------------------------------------------------------------------------------- /step10_chapter10_security/print-queries/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "start": "node app" 5 | }, 6 | "dependencies": { 7 | "express": "5.0.0-alpha.2" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /step11_chapter11_Deployment Assets & Heroku/grunt-examples/.gitignore: -------------------------------------------------------------------------------- 1 | tmp 2 | -------------------------------------------------------------------------------- /step11_chapter11_Deployment Assets & Heroku/grunt-examples/app.js: -------------------------------------------------------------------------------- 1 | var express = require("express"); 2 | var path = require("path"); 3 | 4 | var app = express(); 5 | 6 | app.use(express.static(path.resolve(__dirname, "public"))); 7 | app.use(express.static(path.resolve(__dirname, "tmp/serve"))); 8 | 9 | app.listen(3000, function() { 10 | console.log("App started on port 3000."); 11 | }); 12 | -------------------------------------------------------------------------------- /step11_chapter11_Deployment Assets & Heroku/grunt-examples/my_css/main.less: -------------------------------------------------------------------------------- 1 | article { 2 | display: block; 3 | h1 { 4 | font-size: 16pt; 5 | color: #900; 6 | } 7 | p { 8 | line-height: 1.5em; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /step11_chapter11_Deployment Assets & Heroku/grunt-examples/my_javascripts/main.js: -------------------------------------------------------------------------------- 1 | var randomString = require("random-string"); 2 | 3 | console.log(randomString({ length: 10 })); 4 | -------------------------------------------------------------------------------- /step11_chapter11_Deployment Assets & Heroku/heroku-app/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /step11_chapter11_Deployment Assets & Heroku/heroku-app/Procfile: -------------------------------------------------------------------------------- 1 | web: npm run production 2 | -------------------------------------------------------------------------------- /step11_chapter11_Deployment Assets & Heroku/heroku-app/app.js: -------------------------------------------------------------------------------- 1 | var express = require("express"); 2 | var app = express(); 3 | 4 | app.set("port", process.env.PORT || 3000); 5 | 6 | app.get("/", function(req, res) { 7 | res.send("Hello world!"); 8 | }); 9 | 10 | app.listen(app.get("port"), function() { 11 | console.log("App running on port " + app.get("port")); 12 | }); 13 | -------------------------------------------------------------------------------- /step11_chapter11_Deployment Assets & Heroku/heroku-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "start": "node app", 5 | "production": "forever app.js" 6 | }, 7 | "dependencies": { 8 | "express": "5.0.0-alpha.2", 9 | "forever": "^0.13.0" 10 | }, 11 | "engines": { 12 | "node": "0.10.x" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /step12_chapter12/express-generated-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "express-generated-app", 3 | "version": "0.0.0", 4 | "private": true, 5 | "scripts": { 6 | "start": "node ./bin/www" 7 | }, 8 | "dependencies": { 9 | "body-parser": "~1.12.0", 10 | "cookie-parser": "~1.3.4", 11 | "debug": "~2.1.1", 12 | "express": "~4.12.2", 13 | "jade": "~1.9.2", 14 | "morgan": "~1.5.1", 15 | "serve-favicon": "~2.2.0" 16 | } 17 | } -------------------------------------------------------------------------------- /step12_chapter12/express-generated-app/public/stylesheets/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding: 50px; 3 | font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; 4 | } 5 | 6 | a { 7 | color: #00B7FF; 8 | } -------------------------------------------------------------------------------- /step12_chapter12/express-generated-app/routes/index.js: -------------------------------------------------------------------------------- 1 | var express = require('express'); 2 | var router = express.Router(); 3 | 4 | /* GET home page. */ 5 | router.get('/', function(req, res, next) { 6 | res.render('index', { title: 'Express' }); 7 | }); 8 | 9 | module.exports = router; 10 | -------------------------------------------------------------------------------- /step12_chapter12/express-generated-app/routes/users.js: -------------------------------------------------------------------------------- 1 | var express = require('express'); 2 | var router = express.Router(); 3 | 4 | /* GET users listing. */ 5 | router.get('/', function(req, res, next) { 6 | res.send('respond with a resource'); 7 | }); 8 | 9 | module.exports = router; 10 | -------------------------------------------------------------------------------- /step12_chapter12/express-generated-app/views/error.jade: -------------------------------------------------------------------------------- 1 | extends layout 2 | 3 | block content 4 | h1= message 5 | h2= error.status 6 | pre #{error.stack} 7 | -------------------------------------------------------------------------------- /step12_chapter12/express-generated-app/views/index.jade: -------------------------------------------------------------------------------- 1 | extends layout 2 | 3 | block content 4 | h1= title 5 | p Welcome to #{title} 6 | -------------------------------------------------------------------------------- /step12_chapter12/express-generated-app/views/layout.jade: -------------------------------------------------------------------------------- 1 | doctype html 2 | html 3 | head 4 | title= title 5 | link(rel='stylesheet', href='/stylesheets/style.css') 6 | body 7 | block content --------------------------------------------------------------------------------