Purpose
The purpose of this assignment is to set up your GitHub and Render instances for future assignments. You will create an Echo server, setup auto-deployment on Render, and test the server using Postman.
Prerequisites
- Sign up for a free GitHub account if you don’t already have one.
- Accept GitHub Classroom – this should have been provided to you by your instructor. Classroom Assignment1
- GitHub Classroom will clone the repository CSC3916_Assignment1 for you into your GitHub Classroom repository.
- Sign up for a free account on Render.
Steps
Step 1: Creating an Echo Server
- Navigate to the cloned repository on your GitHub Classroom repository.
- Create a new file
server.js
. - Implement an Echo server using Node.js and Express.js. This server should respond with the same string it receives in a POST request.
Step 2: Setting up Auto-deployment on Render
- Follow the steps in the Render guide to setup auto-deployment from your GitHub repository.
Step 3: Creating a Postman Request
Open Postman and create a new POST request to your Render-deployed Echo server.
Create an environment variable
echo_body
for the body of your request.In the ‘Tests’ tab, write tests to validate the response such as status code, response body, and response time.
// Check if the status code of the response is 200 pm.test("Status code is 200", function () { pm.response.to.have.status(200); }); // Check if the response time is less than 200ms pm.test("Response time is less than 200ms", function () { pm.expect(pm.response.responseTime).to.be.below(200); }); // Check if the response body is equal to the echo_body environment variable pm.test("Response body is correct", function () { pm.expect(pm.response.text()).to.equal(pm.environment.get("echo_body")); });
Step 4: Creating readme and Sharing Collection
- Create a
readme.md
file at the root of your GitHub repository. - Share your Postman collection and include it in your readme. Make sure to include your environment settings.
Step 5: Submission
- Commit and push all your changes to your GitHub repository.
- Submit the GitHub repository URL to Canvas.
Rubric
- -5: Not deployed to Render.
- -5: Missing Postman Test.
- -1: For each missing assert (test).
Resources
- Node.js
- Passport.js Documentation - Basic Digest
- Render Documentation - Deploy Node.js & Express.js app
- Creating an Echo Server in Node.js (YouTube Video)
- Deploy on render (YouTub Video)
- How to write tests in Postman (YouTube Video)
Replace “your-collection-id” with the actual ID of your collection.