DEV Community

Cover image for Start a server: Node Vs Golang
Abayomi Ogunnusi
Abayomi Ogunnusi

Posted on


Start a server: Node Vs Golang

Disclaimer: The purpose of this post is not to compare the two programs; rather, it is to demonstrate how to start the server.

Today, we'll look at how to start our server in Node.js with the express framework and Nodemon, as well as in Golang with the fiber framework and air.



Initialize your project

npm init -y

Install Pacakages

npm i express and npm i -D nodemon

Start server
node index
Enter fullscreen mode Exit fullscreen mode
const express = require("express")
const app  = express()

const port = process.env.PORT || 4546

app.get("/", (req,res)=>{
  res.send("Home page")
app.listen(port, ()=>{
   console.log(`app is running on port ${port}`)
Enter fullscreen mode Exit fullscreen mode

Image description


Initialize your project

go mod init ""

Install Pacakages

go get ""
go get ""

Start server
package main

import (


func welcome(c *fiber.Ctx) error {
    return c.SendString("Welcome")

func main() {
    app := fiber.New()

    app.Get("/api", welcome)


Enter fullscreen mode Exit fullscreen mode
Run go server
## Method 1

go run main.go

Image description

## Method 2: with hot reload

Install the air packagehere

To install:
curl -sSfL | sh -s -- -b $(go env GOPATH)/bin

Run: air

Image description


What other frameworks do you use for Golang and Nodejs besides fiber and Express?

Top comments (0)

📰 JavaScript Ecosystem Brief

Here are the top 3 trends in the JavaScript ecosystem:

  1. 📚 7 Libraries You Should Know as a React Developer: Discover essential libraries for React developers to boost productivity and enhance your applications. Read more

  2. 🚀 React vs. Signals: 10 Years Later: Explore the evolution of reactive programming in JavaScript and how Signals compare to React in modern web development. Read more

  3. 🧠 I Open-Sourced an AI That Creates Any UI in Seconds: Learn about an open-source AI-powered tool that helps you generate UI components quickly and efficiently. Read more

Stay updated on these exciting developments in the JavaScript ecosystem!