Coder Social home page Coder Social logo

aws_template's Introduction

Full Stack React

Setup

Create an account for AWS. Open the IAM dashboard and select "Users" on the left. Create a new user. Select "Attach policies directly" but do not select anything. We will add permissions at the bucket level.

Next, search for S3 on the AWS web console. Create a bucket and give it the following policy. Make sure to replace the user and bucket with YOUR arns.

Bucket Policies

{
	"Version": "2012-10-17",
	"Statement": [
		{
			"Sid": "Statement1",
			"Effect": "Allow",
			"Principal": {
				"AWS": "arn:aws:iam::YOUR_USER"
			},
			"Action": "s3:GetObject",
			"Resource": "arn:aws:s3:::YOUR_BUCKET/*"
		},
		{
			"Sid": "Statement2",
			"Effect": "Allow",
			"Principal": {
				"AWS": "arn:aws:iam::YOUR_USER"
			},
			"Action": "s3:PutObject",
			"Resource": "arn:aws:s3:::YOUR_BUCKET/*"
		}
	]
}

.env

AWS_REGION=
AWS_SECRET_ACCESS_KEY=
AWS_ACCESS_KEY_ID=
AWS_BUCKET=

Setup your database

Create a database and table following the database.sql file.

Start the server

npm install
npm run server
npm run client

npm Libraries Required for File Upload

NOTE: These have already been installed on this project.

dotenv is used to keep keys as enviornment variables. @aws-sdk/client-s3 is a library for interacting with S3 buckets. express-fileupload allows for req.files to make file upload easier. browser-image-resizer is a client side library to resize images before sending to the server. If you're displaying the images on the web, it's good practice to resize and compress the images to increase load times.

npm install dotenv
npm install @aws-sdk/client-s3
npm install express-fileupload
npm install browser-image-resizer

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.