- https://medium.com/@bhargavbachina
- @bhargavbachina
- channel/UCWLSuUulkLIQvbMHRUfKM-g
- https://www.amazon.com/Ultimate-Full-Stack-Development-MEVN-Production-Grade/dp/8197651175/ref=sr_1_1?dib=eyJ2IjoiMSJ9.NOkSGHiZ7Bvz5Y6sePEFqxaVeHjSnQFAnAr0HvWBEVE.FAER5zs6Xd9phpebupVlW5bBtauH-6W9Zfvr5bb0-k0&dib_tag=se&qid=1721579618&refinements=p_27%3ABhargav+Bachina&s=books&sr=1-1&text=Bhargav+Bachina
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var express = require("express"), | |
| bodyParser = require("body-parser"), | |
| logger = require('./logger/logger'), | |
| app = express(), | |
| port = 3070; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # from base image node | |
| FROM node:8.11-slim | |
| RUN mkdir -p /usr/src/app | |
| WORKDIR /usr/src/app | |
| # copying all the files from your file system to container file system | |
| COPY package.json . | |
| # install all dependencies |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var express = require("express"), | |
| bodyParser = require("body-parser"), | |
| logger = require('./logger/logger'), | |
| app = express(), | |
| port = 3070; | |
| app.use(bodyParser.json()); | |
| app.get("/", function(req, res) { | |
| logger.info("default route"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| node_modules/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const path = require('path'); | |
| module.exports = { | |
| entry: './index.js', | |
| output: { | |
| path: path.resolve(__dirname, 'dist'), | |
| filename: 'api.bundle.js' | |
| }, | |
| target: 'node' | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # from base image node | |
| FROM node:8.11-slim | |
| RUN mkdir -p /usr/src/app | |
| WORKDIR /usr/src/app | |
| # copy oter files as well | |
| COPY dist/api.bundle.js . | |
| #expose the port |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "user_api", | |
| "version": "1.0.0", | |
| "description": "sample rest api", | |
| "main": "index.ts", | |
| "scripts": { | |
| "test": "echo \"Error: no test specified\" && exit 1" | |
| }, | |
| "repository": { | |
| "type": "git", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "user_api", | |
| "version": "1.0.0", | |
| "description": "sample rest api", | |
| "main": "index.ts", | |
| "scripts": { | |
| "test": "echo \"Error: no test specified\" && exit 1" | |
| }, | |
| "repository": { | |
| "type": "git", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as express from 'express'; | |
| import * as bodyParser from 'body-parser'; | |
| class App { | |
| public express: express.Application; | |
| constructor() { | |
| this.express = express(); | |
| this.middleware(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as express from 'express'; | |
| import * as bodyParser from 'body-parser'; | |
| class App { | |
| public express: express.Application; | |
| // array to hold users | |
| users: any[]; |