by Sai gowtham

How to change a port number in Gatsby

In this tutorial, we are going to learn about how to change a default port number (8000) in gatsby project.

Changing the port number

  1. Open the gatsby project in your favorite code editor.

  2. Navigate to package.json file and add the following config to gatsby develop command.

package.json
{
  "name": "gatsby-starter",
  "private": true,
  "description": "A starter for Gatsby",
  "version": "0.1.0",
  "license": "0BSD",
  "scripts": {
    "build": "gatsby build",
    "develop": "gatsby develop -p 3500",

Here I set a port number 3500 using -p flag.

  1. Start the development server by running the npm run develop command, your port number is changed successfully.
You can now view gatsby-starter in the browser.
⠀
  http://localhost:3500/
⠀
View GraphiQL, an in-browser IDE, to explore your site's data and schema
⠀
  http://localhost:3500/___graphql
⠀
Note that the development build is not optimized.
To create a production build, use gatsby build

If you want to change a port number temporarily, you need to add a -p flag with the port number to the gatsby develop command.

gatsby develop -p 3500

or

gatsby develop --port 3500

Css Tutorials & Demos

How rotate an image continuously in CSS

In this demo, we are going to learn about how to rotate an image continuously using the css animations.

How to create a Instagram login Page

In this demo, i will show you how to create a instagram login page using html and css.

How to create a pulse animation in CSS

In this demo, i will show you how to create a pulse animation using css.

Creating a snowfall animation using css and JavaScript

In this demo, i will show you how to create a snow fall animation using css and JavaScript.

Top Udemy Courses

JavaScript - The Complete Guide 2021 (Beginner + Advanced)
JavaScript - The Complete Guide 2021 (Beginner + Advanced)
64,026 students enrolled
52 hours of video content
View Course
React - The Complete Guide (incl Hooks, React Router, Redux)
React - The Complete Guide (incl Hooks, React Router, Redux)
284,472 students enrolled
40 hours of video content
View Course
Vue - The Complete Guide (w/ Router, Vuex, Composition API)
Vue - The Complete Guide (w/ Router, Vuex, Composition API)
152,857 students enrolled
48.5 hours of video content
View Course