๐
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
# This is a basic workflow to help you get started with Actions | |
name: CI | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push or pull request events but only for the master branch | |
push: | |
branches: [ master ] | |
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
upstream nodejs_upstream{ | |
server 127.0.0.1:3000; | |
keepalive 64; | |
} | |
server { | |
listen 80; | |
server_name tutorial.codepanthers.com; | |
location / { |
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
private string GetPrivateUrl(string file) | |
{ | |
try | |
{ | |
return | |
AmazonCloudFrontUrlSigner.GetCannedSignedURL( | |
"https://" + CloudFrontDomain + "/" + file, | |
new StreamReader(@"PrivateKey.pem"), | |
CloudFrontKeyId, | |
DateTime.Now.AddDays(7) |
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 app = express(); | |
const PORT = process.env.PORT || 80; | |
app.get("/",(req,res)=> { | |
res.send("Hello From Code Panthers"); | |
res.end(); | |
}) | |
app.listen(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
# Logs | |
logs | |
*.log | |
npm-debug.log* | |
yarn-debug.log* | |
yarn-error.log* | |
lerna-debug.log* | |
.pnpm-debug.log* | |
# Diagnostic reports (https://nodejs.org/api/report.html) |
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
[HttpPost("register")] | |
public async Task<IActionResult> RegisterEmailSubscription([FromBody] string email) | |
{ | |
if (string.IsNullOrEmpty(email)) | |
{ | |
return BadRequest(new { status = "Failed", message = "Enter a valid Email Address" }); | |
} | |
else | |
{ | |
await _notificationService.RegisterSubscirption(email); |
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
public async Task<string> GetS3ObjectPresignedUrl(IFormFile file) | |
{ | |
try | |
{ | |
var key = Path.GetRandomFileName() + Guid.NewGuid().ToString() + Path.GetExtension(file.FileName).ToLowerInvariant(); | |
if (await UploadFileToS3(file, key)) | |
{ | |
var getUrlRequest = new GetPreSignedUrlRequest | |
{ | |
BucketName = BucketName, |
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
using Amazon.SimpleNotificationService; | |
using Amazon.SimpleNotificationService.Model; | |
using Microsoft.Extensions.Configuration; | |
using System; | |
using System.Threading.Tasks; | |
namespace CodePanthers.AWS.S3.UploadService.Services | |
{ | |
public class NotificationService : INotificationService | |
{ |
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
using System.Threading.Tasks; | |
namespace CodePanthers.AWS.S3.UploadService.Services | |
{ | |
public interface INotificationService | |
{ | |
Task SendUploadNotification(string topic, string message); | |
Task SendUploadNotification(string message); | |
Task RegisterSubscirption(string email); | |
Task RegisterSubscirption(string topic, string email); |
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": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "VisualEditor0", | |
"Effect": "Allow", | |
"Action": [ | |
"sns:Publish", | |
"sns:Subscribe" | |
], |
NewerOlder