- 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
version: '3.8' | |
services: | |
db: | |
image: postgres:14.1-alpine | |
restart: always | |
environment: | |
- POSTGRES_USER=postgres | |
- POSTGRES_PASSWORD=postgres | |
ports: | |
- '5432:5432' |
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 axios = require('axios'); | |
export class UserService { | |
public async getUsers() { | |
return await axios.get('/api/users'); | |
} | |
public async getContacts() { | |
return await axios.get('/api/contacts'); |
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 axios = require('axios'); | |
async function getUsers() { | |
return await axios.get('/api/users'); | |
} | |
async function getContacts() { | |
return await axios.get('/api/contacts'); |
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
module.exports = (sequelize, DataTypes, Model) => { | |
class Tasks extends Model {} | |
Tasks.init({ | |
// Model attributes are defined here | |
name: { | |
type: DataTypes.STRING, | |
allowNull: false | |
}, |
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 { Sequelize, Model, DataTypes } = require("sequelize"); | |
const logger = require('../logger/api.logger'); | |
const connect = () => { | |
const hostName = process.env.MYSQL_HOST; | |
const userName = process.env.MYSQL_USER; | |
const password = process.env.MYSQL_PASSWORD; | |
const database = process.env.MYSQL_DATABASE; | |
const dialect = process.env.MYSQL_DIALECT; |
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 { connect } from "../config/db.config"; | |
import { APILogger } from '../logger/api.logger'; | |
import { Tasks } from "../model/task.model"; | |
export class TaskRepository { | |
private logger: APILogger; | |
private db: any = {}; | |
private taskRespository: any; |
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 { Table, Column, Model, HasMany } from 'sequelize-typescript' | |
@Table | |
export class Tasks extends Model { | |
@Column | |
name: string | |
@Column | |
description: string |
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 { Sequelize } from 'sequelize-typescript' | |
import { Dialect } from 'sequelize'; | |
import { Tasks } from '../model/task.model'; | |
export const connect = () => { | |
const hostName = process.env.MYSQL_HOST; | |
const userName = process.env.MYSQL_USER; | |
const password = process.env.MYSQL_PASSWORD; | |
const database = process.env.MYSQL_DATABASE; |
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
{ | |
"IsEncrypted": false, | |
"Values": { | |
"FUNCTIONS_WORKER_RUNTIME": "node", | |
"AzureWebJobsStorage": "", | |
"MYSQL_USER": "apidemo", | |
"MYSQL_HOST": "azure-mysql-demo.mysql.database.azure.com", | |
"MYSQL_PASSWORD": "Tester@321", | |
"MYSQL_DATABASE": "tasks", | |
"MYSQL_DIALECT": "mysql" |
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
CREATE TABLE TASKS( | |
ID INT PRIMARY KEY NOT NULL, | |
NAME CHAR(100) NOT NULL, | |
DESCRIPTION CHAR(500), | |
CREATEDAT DATE, | |
UPDATEDAT DATE, | |
CREATEDBY CHAR(50), | |
UPDATEDBY CHAR(50) | |
); |
NewerOlder