GithubHelp home page GithubHelp logo

mock-api-one's Introduction

mock-api-one

Build a test mock api and deploy to Heroku for development use

This process is modelled from Ania Kubow's YouTube video: https://www.youtube.com/watch?v=FLnxgSZ0DG4 and takes advantage of json-server: https://github.com/typicode/json-server

Process Overview

  1. Create db.json and put some default data in there so when we test, we can clearly see if it's working
  2. Install json-server on the machine globally: npm install -g json-server
  3. Fire up the json-server: json-server --watch db.json
  4. Make sure you have a Heroku account and activate and commit to GitHub
  5. Initialise the project and create a package.json file: npm init
  6. Add json server to the package.json file: npm i json-server so it is shipped when deployed to Heroku
  7. Add start to scripts in package.json and add file server.js. This will act as a mini back-end on Heroku
  8. Add a .gitignore so the node_modules will not be uploaded to GitHub
  9. Make another commit to GitHub
  10. Install/update Heroku CLI:
    • Mac: brew tap heroku/brew && brew install heroku
    • Linux: sudo snap install --classic heroku
  11. Install Heroku globally on machine: npm install -g heroku
  12. Make sure to be logged into heroku and create Heroku project: heroku create projectName

Once complete you will receive an end point ending with herokuapp.com, save this

  1. Push the project to Heroku: git push heroku main (we are in the main branch)

Thats it You now have an endpoint that can be used for all crud operations!

mock-api-one's People

Contributors

adamskoullos avatar

Watchers

 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.