Giter Site home page Giter Site logo

node-api4-project's Introduction

Deployment and Best Practices

In this challenge, you will build a simple Express app that is deployable to Heroku. This means that it has a proper start script in the package.json file, and that the port number is taken from the environment instead of it being hard-coded. Feel free to deploy your app to Heroku, but bear in mind that this is not a free service anymore.

Instructions

Task 1: Project Setup and Submission

Your assignment page on Canvas should contain instructions for submitting this project. If you are still unsure, reach out to School Staff.

Task 2: Minimum Viable Product

  • Build a simple API:

    • Create a .gitignore file executing npx gitignore node

    • Create a package.json file executing npm init --y

    • Add Eslint to the project executing npx eslint --init

    • Edit the package.json file to add "start" and "server" scripts

    • Install express, dotenv, cors

    • Add support for environment variables using an .env file and the dotenv library, providing fallbacks in the code

    • Flesh out the API:

      Method URL Description
      GET /api/users Returns an array users.
      POST /api/register Creates a user from { username, password } in the request body, responds with newly created user.
      POST /api/login Checks { username, password } in the request body, responds with a welcome message.
  • OPTIONALLY deploy your app to Heroku. The link to the repo on Github is your actual submission deliverable.

Important Notes

  • You can make the API return totally hard-coded responses for the requests from clients (no database).
  • Alternatively you can use an in-memory array to persist users and act as a database, and build database helpers that interact with the users array.
  • If you persist users in an array database, know that storing passwords in plain text is a very bad practice from a security standpoint.

Stretch Yourself

  • Research how to avoid storing passwords as is in your array database.
  • Research how to grant access to GET /api/users only those clients that are registered and logged in.
  • Create a front-end piece inside the project containing a register/login form and the means to display users.

node-api4-project's People

Contributors

ladrillo avatar luishrd avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

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.