Skip to content

This repository is just me learning how to set up a basic server in Golang.

Notifications You must be signed in to change notification settings

rabi-siddique/backend-golang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Go vs Express Comparison

Feature Go HTTP Server Express Server (Node.js)
Setup Minimal, built-in net/http package Requires express package installation
Port Can specify, e.g., :8080 Can specify, e.g., 3000
Routing Uses http.HandleFunc() Uses app.get(), app.post(), etc.
Dependency None, part of Go standard library Needs express package
Performance Often faster for simple HTTP handling Slightly slower but highly flexible

JSON Response Handling: Go vs Express

Feature Go JSON Response Example Express JSON Response Example
Library/Package encoding/json express
Response Method json.NewEncoder(w).Encode(response) res.json(data)
Struct Fields Must be exported (capitalized) Automatically uses object properties
Error Handling Manual error checking when encoding JSON Automatic error handling and response management

About

This repository is just me learning how to set up a basic server in Golang.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published