- 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
| { | |
| "ignore": [".git", "node_modules"], | |
| "watch": ["./"], | |
| "exec": "npm start", | |
| "ext": "ts" | |
| } |
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'; | |
| import { Logger } from './logger/logger' | |
| class App { | |
| public express: express.Application; | |
| public logger: Logger; | |
| // rest of the file are left for brevity |
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
| // left for brevity | |
| // handle undefined routes | |
| this.express.use('*', (req,res,next) => { | |
| res.send("Make sure url is correct!!!"); | |
| }); |
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'; | |
| import { Logger } from './logger/logger'; | |
| import Routes from './routes/routes'; | |
| class App { | |
| public express: express.Application; | |
| public logger: Logger; |
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
Show hidden characters
| { | |
| "compilerOptions": { | |
| "outDir": "./dist/", | |
| "sourceMap": true, | |
| "noImplicitAny": true, | |
| "module": "commonjs", | |
| "target": "es5", | |
| "allowJs": true | |
| }, | |
| "exclude":[ |
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": { | |
| "start": "ts-node index.ts", | |
| "start:dev": "./node_modules/nodemon/bin/nodemon.js", | |
| "test": "echo \"Error: no test specified\" && exit 1", | |
| "tslint": "tslint --project tsconfig.json --config tslint.json", |
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": { | |
| "start": "ts-node index.ts", | |
| "start:dev": "./node_modules/nodemon/bin/nodemon.js", | |
| "test": "echo \"Error: no test specified\" && exit 1", | |
| "tslint": "tslint --project tsconfig.json --config tslint.json", |
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 path = require('path'); | |
| module.exports = { | |
| entry: ["./index.ts"], | |
| output: { | |
| filename: 'api.bundle.js', | |
| path: path.resolve(__dirname,"dist") | |
| }, | |
| module: { | |
| rules: [ |
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 |