Simple filter API used to resize and apply grayscale filter on images, made by Udacity's community for Cloud compute advanced track.
# | Name | Version | Type | # | Name | Version | Type |
---|---|---|---|---|---|---|---|
1 | @types/bluebird | ^3.5.33 | Dev | 7 | bestzip | ^2.2.1 | Dep |
2 | @types/express | ^4.17.0 | Dev | 8 | dotenv | ^16.0.3 | Dep |
3 | @types/node | ^11.13.17 | Dev | 9 | express | ^4.17.1 | Dep |
4 | ts-node-dev | ^1.0.0-pre.40 | Dev | 10 | jimp | ^0.16.1 | Dep |
5 | tslint | ^5.18.0 | Dev | 11 | lodash | ^4.17.15 | Dep |
6 | typescript | ^4.9.4 | Dev | 12 | rimraf | ^3.0.2 | Dep |
- to install the project you need to get a copy of files through downloading them or using git commands
git clone <REPO>
- next step after downloading you need to install it using the command:
npm i
- for development mode run the command:
npm run dev
For Linux users or Windows with linux commands
- to run at production you need to build server using command:
npm run build
For Windwos/Linux users
- to run at production you need to build server using command:
npm run build:win
- "/" Main end point which shows how to use the API
- "/filteredimage" API endpoint which runs a request using the query
?image_url
with the required image link to apply filters
e.g:
/filteredimage?image_url=<IMG_URL>
- You need to a valid access to AWS account with root user or using IAM roles
- You need to install the AWS CLI using the AWS CLI guide
- You need to install the EB CLI using the AWS EB CLI guide
- You need firstly to configure your AWS cli using your credentials by running the command
aws configure
then follow steps on screen using your IAM Role with programatic access
- to make sure that you have done the AWS configuration, run this command on your PC
%userprofile%/.aws/config
and use NOTEPAD as a text editor to read it it must appear like this
[profile default]
aws_access_key_id = xxxxxxxxxxxxxxxxx
aws_secret_access_key = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
region = us-east-1
output = json
[default]
- create .npmrc file using the command
touch .npnrc
to allow eb node_modules installation permissions, and save it after adding this text in it
unsafe-perm=true
- prepare package.json with the deploy and build scripts like that
{
"clean": "rm -rf www/ || true",
"build": "npm i && npm run clean && tsc && cd www && mkdir tmp && cd .. && cp -R .elasticbeanstalk www/.elasticbeanstalk && cp .npmrc www/.npmrc && cp package.json www/package.json && cd www && zip -r Archive.zip . && cd ..",
"deploy": "npm run build && eb list && eb use udagram-api && eb deploy && eb setenv PORT=8080",
}
-
next you need to run the following commands into the main folder of the project to start deployment process
- first run the Elastic Beanstalk initializing command to create the eb folder:
eb init <APP_NAME>
- after initializing the eb, go to file
./.elasticbeanstalk/config.yml
and add the deployment artifact zip to the end like that
deploy: artifact: www/Archive.zip
also set the AWS profile like that
profile: default
- now create your environment using the command
eb create --sample <env_name>
all done, you can start deployment process
for Linux OS Only
npm run deploy
for Windows/Linux OS
npm run deploy:win
- first run the Elastic Beanstalk initializing command to create the eb folder:
-
🔗 Running on : AWS EB/EC2 Link