Advancing Towards Deployment: Exploring Hosting Platforms and Streamlining the Process - Day 117 of #365DaysOfCode

ยท

3 min read

Day 117 of #365DaysOfCode

I found that React's built-in createContext and useContext hooks didn't quite meet my requirements. These hooks are typically used to pass data through the component tree without having to pass props down manually at every level, which can be very handy in certain scenarios. However, in my specific case, these tools fell short of delivering the desired functionality, possibly due to the complexity or unique needs of the project. As a result, I am considering using Higher-Order Components (HOCs) instead. HOCs are a powerful tool in React that can manipulate props and states, enhance components with additional functionalities, and overall offer more flexibility.

Today, I also conducted further research on hosting platforms. I've made good progress, and I'm striving to keep it simple, all while still adhering to the best practices for deployment.

To deploy a Node.js and Express backend along with a React frontend, you have several options depending on your requirements and preferences. Here are a few common deployment options:

  1. Heroku: Heroku is a popular platform for deploying web applications. It supports Node.js applications and provides an easy deployment process. You can deploy both your backend and frontend separately as separate Heroku apps or use Heroku's buildpacks to deploy them as a single app.

  2. Netlify: Netlify is a powerful platform for deploying static websites, which is suitable for hosting your React frontend. You can build your React app and deploy it to Netlify, and then configure your backend API to be consumed by the frontend. Netlify also offers serverless functions that can be used to handle server-side logic.

  3. AWS (Amazon Web Services): AWS provides various services that can be used to deploy and host your application. For the backend, you can use AWS Elastic Beanstalk, AWS Lambda with API Gateway, or set up your own EC2 instance. For the frontend, you can use AWS S3 to host the static files or use AWS Amplify for a more streamlined deployment process.

  4. Firebase: Firebase is a popular development platform that offers hosting capabilities for static files and serverless functions. You can host your React frontend using Firebase Hosting and deploy your Node.js backend as Firebase Functions. Firebase also provides other useful features such as authentication, database, and storage.

  5. Deploying to Render is a great option for hosting your Node.js and React application. Render provides an easy-to-use platform with built-in support for various technologies and a straightforward deployment process. Render also takes care of automatic scaling, which is great in case you get lucky and your app goes viral ๐Ÿ˜‰

When choosing a deployment option, it's important to consider factors such as ease of use, scalability, cost, deployment process, and any specific requirements or integrations your application needs.

Once I've gone through the process myself, I'm considering writing a step-by-step post on how to deploy to a hosting platform. Stay tuned!

Day 17 of #100DaysOfPython: I continued with the Python course and completed some small projects. Here's an example: a secret auction program. I'm not sure what the fun in a secret auction would be, lol.

from replit import clear

bids = {}
bidding_finished = False

def find_highest_bidder(bidding_record):
  highest_bid = 0
  winner = ""
  for bidder in bidding_record:
    bid_amount = bidding_record[bidder]
    if bid_amount > highest_bid:
      highest_bid = bid_amount
      winner = bidder
  print(f"The winner is {winner} with a bid of ${highest_bid}")

while not bidding_finished:
  name = input("Name? ")
  price = int(input("Bid? $"))
  bids[name] = price
  should_continue = input("Are there any other bidders? Please type 'yes' or 'no'.")
  if should_continue == 'no':
    bidding_finished = True
    find_highest_bidder(bids)
  elif should_continue == 'yes':
    clear()
ย