touch server.js
npm init -y
npm install express
- Build basic express server. a. Require the express package. b. Create an instance of express (probably app) c. Define a PORT d. Listen on the PORT e. Add middleware for JSON POST body
Algorithm API is a server api which is designed to take in a user's input and return the requested response using basic algorithmic patterns.
This endpoint takes in a string and determines if any "bad" words are included. If so, it filters them out and returns the string.
i.e.
const badWordsArray = ["banana", "apple", "orange"];
const stringToEvaluate = "I really hope I get an apple";
message = "I really hope I get an "
- Filter Words is available on the endpoint "/api/filter"
- Filter Words requires a POST body in the following JSON format:
{ "stringToEvaluate": "Banana rama fo fee fi fo fama" }
- Filter Words returns a response in the following format:
{ "error": false, "message": " rama fo fee fi fo fama" }
- Login to Heroku if not already logged in.
- Add and Commit changes to local git.
- Push changes to GitHub (if applicable)
- Run
heroku create
- Run
git push heroku master