Code Monkey home page Code Monkey logo

tracking-system-api's Introduction

To get started

  1. yarn init -y
  2. yarn add express body-parser mongodb mongoose nodemon
  3. touch index.js
  4. mongod
  5. yarn start
  6. write your code

Deploying database to Mongodb Cloud

  1. Visit https://cloud.mongodb.com/ and sign up, choose "FREE"
  2. Cloud Provider & Region, choose AWS (default)
  3. Region, choose N. Virginia us-east-1 (default)
  4. Cluster Tier, choose M0 Sandbox (default)
  5. Cluster Name, name it something relevant to your app
  6. Click "Create cluster"
  7. Left panel, click "Database Access"
  8. Click "Add New Database User"
  9. Authentication Method, choose "Password" (default)
  10. Password Authentication, username: "admin", password: whatever you want
  11. Database User Privileges, choose "Atlas admin"
  12. Click "Add User"
  13. Left panel, click "Network Access"
  14. Click "ALLOW ACCESS FROM ANYWHERE"
  15. Click "Confirm"
  16. Left panel, click "Clusters"
  17. Click "Connect"
  18. Click "Connect your application"
  19. Copy the url to index.js in VSCode and replace the string where we have mongoose.connect('mongodb://localhost:27017/something'), the is what you decided in step 10, the you're making it up right now, name it something relevant
  20. Save file then git add, git commit, and git push this change

Deploying api to Heroku

  1. Visit https://heroku.com and sign up
  2. Click "New" then "Create new app"
  3. Give it a name then click "Create app"
  4. Click "Github Connect to Github"
  5. Search for a repository to connect to, type the repo and click "Search"
  6. Click "Connect"
  7. Click "Enable Automatic Deploys"
  8. In VSCode, change index.js where app.listen(3001 to app.listen(process.env.PORT || 3001
  9. Save file then git add, git commit, and git push this change
  10. Visit your app i.e. https://tracking-system-api.herokuapp.com/api/v1/users (notice the /api/v1/), should see an empty array until you put some data into your database that's hosted on mongodb. If you see "Application error" that's not good. Repeat the steps or ask for help.

Deploying frontend to Netlify

While you can deploy your frontend to Heroku, I strongly recommend Netlify to work around Heroku's free 1000 hour / month limit. Visit https://github.com/robghchen/tracking-system for instructions.

tracking-system-api's People

Contributors

robghchen 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.