Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Snake Game

A simple one-page Snake game served locally with a minimal Node.js HTTP server (no external dependencies).

Requirements

Start the server

From this project directory, run:

node server.js

You should see:

Snake game running at http://localhost:3000

Open http://localhost:3000 in your browser to play.

To use a different port:

$env:PORT=8080; node server.js

Controls

  • Arrow keys or WASD — move
  • Swipe on the canvas, or the on-screen D-pad — move (touch devices)
  • Space — pause / resume, or restart from the Game Over screen

From the title screen, use Start Game, How to Play, the theme picker, and the Sound toggle to get going.

Mobile / installable app (PWA)

The game is an installable Progressive Web App: open it on a phone and use the browser's "Add to Home Screen" option to launch it full-screen like a native app, including offline play (a Service Worker caches the game's static assets).

If you change index.html, manifest.json, or icons/icon.svg and want returning players to get the update, bump CACHE_NAME in sw.js (e.g. snake-cache-v2) — visitors will see a "New version available" prompt to refresh.

Stop the server

Press Ctrl+C in the terminal where it's running.

Files

  • index.html — the game (HTML, CSS, and JS in one file)
  • server.js — static file server
  • manifest.json — PWA app metadata (name, icons, theme color)
  • sw.js — service worker for offline caching and update prompts
  • icons/icon.svg — app icon

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages