This file contains 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
Resources: | |
sslSecurityGroupIngress: | |
Type: AWS::EC2::SecurityGroupIngress | |
Properties: | |
GroupId: {"Fn::GetAtt" : ["AWSEBSecurityGroup", "GroupId"]} | |
IpProtocol: tcp | |
ToPort: 443 | |
FromPort: 443 | |
CidrIp: 0.0.0.0/0 |
This file contains 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: 0.2 | |
phases: | |
install: | |
commands: | |
- npm i npm@latest -g | |
- pip install --upgrade pip | |
- pip install --upgrade awscli | |
pre_build: | |
commands: |
This file contains 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
# Happy Coding! | |
service: serverless-node | |
provider: | |
name: aws | |
runtime: nodejs8.10 | |
stage: dev | |
region: eu-west-1 |
This file contains 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 express = require('express') | |
const bodyParser = require('body-parser') | |
const serverless = require('serverless-http') | |
const app = express() | |
/* Body Parser */ | |
app.use(bodyParser.json()) | |
app.use(bodyParser.urlencoded({ extended: false })) |
This file contains 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 = require('sequelize') | |
const sequelize = new Sequelize( | |
process.env.DB_NAME, | |
process.env.DB_USERNAME, | |
process.env.DB_PASSWORD, | |
{ | |
host: process.env.DB_HOST, | |
port: process.env.DB_PORT, | |
dialect: process.env.DB_DIALECT, |
This file contains 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'; | |
/** | |
* SEQUELIZE variable is stored in a file named | |
* 'constants' so it can be easily reused anywhere | |
* without being subject to human error. | |
*/ | |
import { SEQUELIZE } from '../utils/constants'; | |
import { User } from '../user/user.entity'; |
This file contains 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 { Module } from '@nestjs/common'; | |
import { databaseProviders } from './database.providers'; | |
@Module({ | |
providers: [...databaseProviders], | |
exports: [...databaseProviders], | |
}) | |
export class DatabaseModule {} |
This file contains 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, | |
DataType, | |
CreatedAt, | |
UpdatedAt, | |
DeletedAt, | |
} from 'sequelize-typescript'; | |
import { IDefineOptions } from 'sequelize-typescript/lib/interfaces/IDefineOptions'; |
This file contains 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 { User } from './user.entity'; | |
import { USER_REPOSITORY } from '../utils/constants'; | |
export const userProviders = [ | |
{ | |
provide: USER_REPOSITORY, | |
useValue: User, | |
}, | |
]; |
This file contains 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
export class CreateUserDto { | |
readonly name: string; | |
readonly age: number; | |
readonly email: string; | |
} |
OlderNewer