Udagram is a simple cloud application developed alongside the Udacity Cloud Engineering Nanodegree. It allows users to register and log into a web client, post photos to the feed, and process photos using an image filtering microservice.
The project is split into three parts:
- The Simple Frontend A basic Ionic client web application which consumes the RestAPI Backend.
- The RestAPI Backend, a Node-Express server which can be deployed to a cloud service.
- The Image Filtering Microservice, the final project for the course. It is a Node-Express application which runs a simple Python script to process images.
You'll need to set up and use a virtual environment for this project.
To create a virtual environment run the following from within the project directory:
- Install virtualenv dependency:
pip install virtualenv
- Create a virtual environment:
virtualenv venv
- Activate the virtual environment:
source venv/bin/activate
(Note: You'll need to do this every time you open a new terminal) - Install dependencies:
pip install -r requirements.txt
When you're done working and leave the virtual environment, run: deactivate
You'll need to create a new node server. Open a new terminal within the project directory and run:
- Initialize a new project:
npm init
- Install express:
npm i express --save
- Install typescript dependencies:
npm i ts-node-dev tslint typescript @types/bluebird @types/express @types/node --save-dev
- Look at the
package.json
file from the RestAPI repo and copy thescripts
block into the auto-generatedpackage.json
in this project. This will allow you to use shorthand commands likenpm run dev
Use our basic server as an example to set up this file. For this project, it's ok to keep all of your business logic in the one server.ts file, but you can try to use feature directories and app.use routing if you're up for it. Use the RestAPI structure to guide you.
It should accept two POST parameter:
image_url: string - a public URL of a valid image file
upload_image_signedUrl: string (OPTIONAL) - a URL which will allow a PUT request with the processed image
It should respond with 422 unprocessable if either POST parameters are invalid.
It should require a token in the Auth Header or respond with 401 unauthorized.
It should be versioned.
The matching token should be saved as an environment variable
(TIP we broke this out into its own auth.router before, but you can access headers as part of the req.headers within your endpoint block)
It should respond with the image as the body if upload_image_signedUrl is included in the request.
It should respond with a success message if upload_image_signedUrl is NOT included in the request.
It should create new SignedURLs required for the imagetoprocess POST Request body.
It should include a POST request to the new server (TIP keep the server address and token as environment variables).
It should overwrite the image in the bucket with the filtered image (in other words, it will have the same filename in S3).
Follow the process described in the course to eb init
a new application and eb create
a new environment to deploy your image-filter service!
Try writing a postman collection to test your endpoint. Be sure to cover:
POST requests with and without tokens POST requests with valid and invalid parameters
Try adding another column to your tables to save a separate key for your filtered image. Remember, you'll have to rename the file before adding it to S3!