├── .gitignore
├── README.md
├── first-web-app-module
├── configurable-module.js
├── first-module.js
└── index.js
├── first-web-app
├── config.json
├── demo-p.js
├── gulpfile.js
├── index.js
├── package.json
└── www
│ └── index.html
├── mongo-rest-api
├── app
│ ├── config
│ │ └── config.js
│ ├── db
│ │ └── mongoose.js
│ ├── middlewares
│ │ └── authenticate.js
│ ├── models
│ │ ├── todo.js
│ │ └── user.js
│ ├── server.js
│ └── tests
│ │ ├── seed
│ │ └── seed.js
│ │ └── server.test.js
├── experiments
│ ├── mongo-connect.js
│ ├── mongo-delete.js
│ ├── mongo-fetch.js
│ ├── mongo-update.js
│ └── mongoose-queries.js
└── package.json
├── note-taking-app
├── README.md
├── note-app.js
├── note-lib.js
├── notes.js
├── one.JPG
├── package.json
├── storage
│ └── notes-data.json
└── yargs-config.json
├── registration-login
├── app
│ ├── configs
│ │ └── index.js
│ ├── db
│ │ └── index.js
│ ├── models
│ │ └── user.js
│ ├── server.js
│ └── views
│ │ ├── home.ejs
│ │ ├── login.ejs
│ │ ├── register.ejs
│ │ └── secret.ejs
└── package.json
├── simple-website
├── README.md
├── logs
│ └── server.log
├── package.json
├── screenshot-1.JPG
├── screenshot-2.JPG
├── server.js
└── views
│ ├── 404.hbs
│ ├── about.hbs
│ ├── home.hbs
│ ├── maintainance.hbs
│ └── partials
│ ├── footer.hbs
│ ├── header.hbs
│ └── materialize
│ ├── css
│ ├── materialize.css
│ └── materialize.min.css
│ ├── fonts
│ └── roboto
│ │ ├── Roboto-Bold.eot
│ │ ├── Roboto-Bold.ttf
│ │ ├── Roboto-Bold.woff
│ │ ├── Roboto-Bold.woff2
│ │ ├── Roboto-Light.eot
│ │ ├── Roboto-Light.ttf
│ │ ├── Roboto-Light.woff
│ │ ├── Roboto-Light.woff2
│ │ ├── Roboto-Medium.eot
│ │ ├── Roboto-Medium.ttf
│ │ ├── Roboto-Medium.woff
│ │ ├── Roboto-Medium.woff2
│ │ ├── Roboto-Regular.eot
│ │ ├── Roboto-Regular.ttf
│ │ ├── Roboto-Regular.woff
│ │ ├── Roboto-Regular.woff2
│ │ ├── Roboto-Thin.eot
│ │ ├── Roboto-Thin.ttf
│ │ ├── Roboto-Thin.woff
│ │ └── Roboto-Thin.woff2
│ └── js
│ ├── materialize.js
│ └── materialize.min.js
├── streams-and-pipes
├── package.json
├── sample-big-file.txt
├── stream-and-pipes.js
├── stream-pipe-on-server.js
├── write-big-file.txt
└── write-big-pipe.txt
├── testing-node
├── package.json
├── server
│ ├── server.js
│ └── server.test.js
└── utils
│ ├── utils.js
│ └── utils.test.js
└── weather-app
├── README.md
├── capture.JPG
├── geochords
└── geochords.js
├── package.json
├── show-weather.js
└── weather
└── weather.js
/.gitignore:
--------------------------------------------------------------------------------
1 | #ignore the modules folder
2 | node_modules/
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Learning NodeJS
2 |
3 | This folder contains all the apps that I made/making while learning Node.
4 | As of now the apps that may be useful to you are :
5 |
6 | * _**Note App**_
7 | * _**Weather App**_
8 | * _**Simple Website**_
9 |
10 | **Keep a watch on this folder to get push updates**
11 |
12 | ### _Star it if you liked it!_
13 |
--------------------------------------------------------------------------------
/first-web-app-module/configurable-module.js:
--------------------------------------------------------------------------------
1 | module.exports = (config)=> {
2 | return {
3 | log: (msg)=>{
4 | console.log(config.prefix + msg);
5 | }
6 | }
7 | };
--------------------------------------------------------------------------------
/first-web-app-module/first-module.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | doIt: ()=>{
3 | console.log("did it!");
4 | },
5 | doSomething: ()=>{
6 | console.log("did something!");
7 | },
8 | getItDone: ()=>{
9 | console.log("got it done!");
10 | }
11 | };
--------------------------------------------------------------------------------
/first-web-app-module/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const firstModule = require('./first-module');
4 | firstModule.doIt();
5 |
6 | const configModule = require('./configurable-module');
7 | const configModuleA = configModule({ prefix: 'A>'});
8 | configModuleA.log('test 1');
9 |
10 | const configModuleB = configModule({prefix:"B>"});
11 | configModuleB.log('test 2');
12 |
13 | // using ES6 destructuring
14 | const {getItDone, doSomething : doS} = require('./first-module');
15 | getItDone();
16 | // using ES6 destructuring alias
17 | doS();
18 |
--------------------------------------------------------------------------------
/first-web-app/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "webServer" : {
3 | "folder" : "www",
4 | "port" : "3030"
5 | }
6 | }
--------------------------------------------------------------------------------
/first-web-app/demo-p.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const http = require('http');
4 | const express = require('express');
5 | const fs = require('fs');
6 |
7 | //open config file asynchronously
8 | const configJSON = fs.readFile('./config.json', 'utf-8', (err, file)=>{
9 | const data = JSON.parse(file);
10 | const app = express();
11 |
12 | // folder in which out static web page are stored
13 | app.use(express.static(data.webServer.folder));
14 |
15 | const httpServer = http.createServer(app);
16 |
17 | httpServer.listen(data.webServer.port, (err)=>{
18 | if (err){
19 | console.log(err.message);
20 | return;
21 | }
22 |
23 | console.log(`Server running at port : ${data.webServer.port}`);
24 | });
25 | });
26 |
27 | console.log("opening config file");
28 |
--------------------------------------------------------------------------------
/first-web-app/gulpfile.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const gulp = require('gulp');
4 |
5 | gulp.task('default', ()=>{
6 | console.log("running our first gulp task");
7 | })
8 |
--------------------------------------------------------------------------------
/first-web-app/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const http = require('http');
4 | const express = require('express');
5 | const fs = require('fs');
6 |
7 | // loading folder and port number from config file
8 | const configJSON = fs.readFileSync('./config.json');
9 | const config = JSON.parse(configJSON);
10 |
11 | const app = express();
12 | app.use(express.static(config.webServer.folder));
13 |
14 | const httpServer = http.createServer(app);
15 |
16 | httpServer.listen(config.webServer.port, (err)=>{
17 | if (err) {
18 | console.log(err.message);
19 | return;
20 | }
21 |
22 | console.log(`server running at port:${config.webServer.port}`);
23 | });
--------------------------------------------------------------------------------
/first-web-app/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "first-web-app",
3 | "version": "0.1.0",
4 | "description": "my first node app",
5 | "main": "index.js",
6 | "scripts": {
7 | "start": "node index",
8 | "test": "echo \"Error: no test specified\" && exit 1"
9 | },
10 | "author": "Ashok Dey",
11 | "license": "MIT",
12 | "dependencies": {
13 | "express": "^4.14.0"
14 | },
15 | "devDependencies": {
16 | "gulp": "^3.9.1"
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/first-web-app/www/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
The URL you are trying to access is either broken or invalid.
9 |{{toUpper message}}
4 |I am a very simple card. I am good at containing small bits of information. 10 | I am convenient because I require little markup to use effectively.
11 |