Learn GLITCH with Real Code Examples
Updated Nov 26, 2025
Code Sample Descriptions
1
Hello World in Glitch (Node.js)
const express = require("express")
const app = express()
app.get("/", (req, res) => {
res.send("Hello World")
})
app.listen(3000, () => {
console.log("Server is running on port 3000")
})
A minimal Node.js app in Glitch that returns 'Hello World' when visited.
2
Hello World in Glitch (Frontend HTML)
<!DOCTYPE html>
<html>
<head>
<title>Hello Glitch</title>
</head>
<body>
<h1>Hello World</h1>
</body>
</html>
A simple frontend HTML file served by Glitch displaying 'Hello World'.
3
Simple JSON API in Glitch
const express = require("express")
const app = express()
app.get("/api", (req, res) => {
res.json({ message: "Hello JSON" })
})
app.listen(3000)
A Glitch Node.js app that returns JSON data when visiting '/api'.
4
Serve Static Files in Glitch
const express = require("express")
const app = express()
app.use(express.static('public'))
app.listen(3000)
A Glitch Node.js app serving static files from the 'public' folder.
5
Hello World with Socket.io
const express = require("express")
const app = express()
const http = require('http').createServer(app)
const io = require('socket.io')(http)
io.on('connection', socket => {
socket.emit('message', 'Hello World')
})
http.listen(3000)
A minimal real-time server with Socket.io in Glitch.
6
Hello World Frontend with JavaScript
<!DOCTYPE html>
<html>
<head>
<title>Hello Button</title>
</head>
<body>
<button onclick="alert('Hello World')">Click Me</button>
</body>
</html>
HTML page with a button showing 'Hello World' in an alert.
7
Glitch Node.js Hello Route
const express = require("express")
const app = express()
app.get('/', (req, res) => res.send('Hello Home'))
app.get('/about', (req, res) => res.send('About Page'))
app.listen(3000)
Glitch app with multiple routes returning different messages.
8
Simple Form in Glitch HTML
<!DOCTYPE html>
<html>
<head>
<title>Form Example</title>
</head>
<body>
<form>
<input type="text" placeholder="Enter Name">
<button type="submit">Submit</button>
</form>
</body>
</html>
An HTML form displayed on Glitch that takes user input.
9
Hello World Express Middleware
const express = require("express")
const app = express()
app.use((req, res, next) => {
console.log(req.method, req.url)
next()
})
app.get('/', (req, res) => res.send('Hello World'))
app.listen(3000)
A Glitch Node.js app using middleware to log requests and return 'Hello World'.
10
Hello World CSS Styling
<!DOCTYPE html>
<html>
<head>
<title>Styled Hello</title>
<style>
h1 { color: blue; font-family: Arial; }
</style>
</head>
<body>
<h1>Hello World</h1>
</body>
</html>
A Glitch HTML page displaying 'Hello World' with CSS styling.