Skip to content

aprilchills/BaseWebApp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Base Web App

Check it out at: https://intense-depths-97149.herokuapp.com/

Today, we’ll get you up and running with a basic web application that you’ll then be able to build off of. But first, there are a few accounts you’ll need to set up and technologies you’ll need to install on your computer.

Part One: Getting the code on your machine

1. Install the tools:

2. Make a copy of the existing project on GitHub by forking it at https://github.com/HubSpot/BaseWebApp.git

Since we believe that building a project that's all your own is more important than understanding how to set up a Node and Express app from scratch, you'll be copying a basic existing project today as a starting point. You do this by "forking" the repo, which creates a copy on your GitHub account.

3. Find and open your terminal

The terminal is a basic way of interacting with your computer through text commands. It'll be very useful in setting your application up. On Windows, it might be called Command Prompt, Git Shell, or Git BASH.

screen shot 2017-04-21 at 11 43 48 am

4. Use the command line to navigate to your desktop:

	cd ~/Desktop  

Then, use the ls (on Mac) or dir (on PC) command to list all files in a directory. It will show you all the items on your desktop, like so:

oct-12-2016 21-51-18

5. Clone the Repository

When you create (or in this case, fork) a repository on GitHub, it exists as a remote repository — that means it exists on a server somewhere, but not on your machine. In order to edit the code, you can clone your repository to create a local copy on your computer and sync between the two locations. Use the command line to

  • (1) clone your project from Github onto your own computer, making sure to replace YourUserName with, well, your username:
 	git clone https://github.com/YourUserName/BaseWebApp.git 

Tip: Press enter after each line.

  • (2) navigate into the project:
	cd BaseWebApp
  • (3) list all the files in the project:
	ls

6. Initialize the app for Heroku

Use the command line to create an app on Heroku. Heroku is the server you'll be pushing your code to. This prepares Heroku to receive your source code (and creates a url for you): Once again, be sure to run these lines one at a time, pressing enter after each command

	heroku login
	heroku create

Note: On Windows, the first command might 'hang' for quite some time (even up to 10-15 minutes) - do not cancel and restart it, usually after this first 'long' run, it works without issues later on.

If you experience any issues with using Heroku on the command line, please refer to [this documentation] (https://devcenter.heroku.com/articles/heroku-cli#troubleshooting) and your error log file.

7. Install the dependencies

Dependencies are all the outside pieces of code your app needs to run. Install the project’s dependencies using npm, a tool used to install any other packages your project needs. View the dependencies your app needs here.

	npm install 

8. Run the project on your machine (your local server)

	heroku local web	

9. View the project running locally

Open a browser and navigate to localhost:5000

10. Make a change in the code and refresh the page running at localhost:5000

Open the project with Visual Studio Code, or whichever text editor you have installed. Make a change to your code. For example, in index.ejs, you could change the header text. Then, refresh your web browser, and you should see the change.

EJS is a templating language that stands for embedded JavaScript. It's like HTML but with some useful tools added. It lets you add JavaScript that gets compiled to HTML before it's sent to the browser.

11. Link your GitHub repo to Heroku

Next, you're going to connect GitHub to Heroku in order to save you steps when deploying your code. Heroku will monitor your repository, and whenever it sees you push a change, it will automatically re-deploy your application so that your changes are incorporated in your live site.

  • Go to https://dashboard.heroku.com/apps
  • Select your app
  • Click the tab ‘Deploy’
  • In ‘Deployment Method’, select ‘Connect to Github’
  • Search for your Repo — remember, it's "BaseWebApp"
  • Click 'connect' and then 'Enable Automatic Deploys'

*We use automatic deploys at HubSpot - but ours go to a 'QA' or 'staging' site. Can you think of why we might do that?

12. Push that change to GitHub, which will automatically deploy to Heroku

*If your server is still running from before (it probably is), you can press control + c to halt it. Note that on a Mac, it's still 'control' not 'command'

	git add .
	git commit -m “made my first change” 
	git push origin master

Git is very powerful, and has lots of features. In order to learn more about git, we recommend this resource.

13. View your app live! (it might take a few seconds to finish deploying)

	heroku open 

Part 2 - Continue to build on your app

A few tips before you begin:

  • Test often- when you make a change, make sure it works. You don't want to add a bunch of stuff and spend tons of time tracking a small bug down.
  • Google everything! - Google is a developer's best friend. No one actually just knows this stuff... you just get really good at knowing what to Google, then reading/incorporating the answers you find.
  • Ask for help - People are dying to help you out! Don't be afraid to ask, no matter how silly you think your question is (because trust me, it's not). Ask a friend, or post on StackOverflow.

Option 1 - Personal website: Add additional pages, navigation, and styling to your app.

Option 2 - Incorporate an API: Learn about how APIs make dynamic web apps possible, and practice integrating one into your app.

Option 3 - Set up a database: Learn how to set up a database, do user authentication, and submit and display user-generated data.

Step-by-step instructions for these can be found in the repo READMEs.


Other resources

Here are some external resources we've gathered to help you with further development.

Git and GitHub tutorials Version control is an important tool for every developer, and git is the most popular one. Learn more useful git commands, discover the branching and then check how to use GitHub for your own project.

Web App tutorials (HTML, CSS, JavaScript) There are plenty of different and more comprehensive tutorials and online resources to learn HTML, CSS and JavaScript.

More Web App tutorials (FE frameworks) Once you have comfortability with JS, CSS and HTML, try out a frontend framework to take your skills to the next level.

Inspiration and problem solving To practice your problem solving skills and find some inspiration, please check the following pages:

  • StackOverflow is a great place to ask any question (or search for it first, because it’s very likely that someone has already asked the same question and got an answer :))
  • Code Pen is a great source of inspiration with a lot of projects based on HTML, CSS and JavaScript
  • Dev.to is a blog platform where you can find plenty of useful posts from other developers.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 47.2%
  • JavaScript 37.1%
  • CSS 15.7%