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
... | |
resource "aws_instance" "jenkins" { | |
ami = data.aws_ami.ubuntu.id | |
instance_type = "t2.micro" | |
security_groups = [aws_security_group.web_traffic.name] | |
key_name = "kluu" | |
provisioner "remote-exec" { | |
inline = [ |
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
provider "aws" { | |
profile = "default" | |
region = "us-east-1" | |
} | |
variable "ingressrules" { | |
type = list(number) | |
default = [80, 443, 22] | |
} |
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
provider "aws" { | |
profile = "default" | |
region = "us-east-1" | |
} | |
data "aws_ami" "ubuntu" { | |
most_recent = true | |
filter { | |
name = "name" |
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
let myExampleNumber: number = 23; | |
myExampleNumber = 'some number'; // This line will throw an error | |
myExampleNumber = 5; // This line will work |
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 { GeneralError } = require('../utils/errors'); | |
const handleErrors = (err, req, res, next) => { | |
if (err instanceof GeneralError) { | |
return res.status(err.getCode()).json({ | |
status: 'error', | |
message: err.message | |
}); | |
} |
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
class GeneralError extends Error { | |
constructor(message) { | |
super(); | |
this.message = message; | |
} | |
getCode() { | |
if (this instanceof BadRequest) { | |
return 400; | |
} if (this instanceof NotFound) { |
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 express = require('express'); | |
const bodyParser = require('body-parser'); | |
const handleErrors = require('./middleware/handleErrors'); | |
const { BadRequest } = require('./utils/errors'); | |
const app = express(); | |
const port = 3000; | |
app.use(bodyParser.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
const express = require('express'); | |
const bodyParser = require('body-parser'); | |
const handleErrors = require('./middleware/handleErrors'); | |
const { BadRequest } = require('./utils/errors'); | |
const app = express(); | |
const port = 3000; | |
app.use(bodyParser.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
const express = require('express'); | |
const bodyParser = require('body-parser'); | |
const app = express(); | |
const port = 3000; | |
app.use(bodyParser.json()); | |
app.post('/post', async (req, res) => { | |
const { title, author } = req.body; |
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 orders = [ | |
{ | |
userId: 1778, | |
amount: 600, | |
createdAt: '1563816223063.0', | |
}, | |
{ | |
userId: 1781, | |
amount: 250, | |
createdAt: '1563965186852.0', |
NewerOlder