Advertisement
ksieradzinski

Untitled

Jan 27th, 2025
14
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. # package.json
  2. {
  3. "name": "my_express_app",
  4. "version": "1.0.0",
  5. "description": "Najprostsza aplikacja Express.js wyświetlająca Hello World",
  6. "main": "app.js",
  7. "scripts": {
  8. "start": "node app.js"
  9. },
  10. "author": "Twoje Imię",
  11. "license": "ISC",
  12. "dependencies": {
  13. "express": "^4.18.2"
  14. }
  15. }
  16.  
  17. # app.js
  18.  
  19. const express = require('express');
  20. const app = express();
  21. const port = 3000;
  22.  
  23. // Definiowanie trasy dla adresu głównego
  24. app.get('/', (req, res) => {
  25. res.send('Hello World');
  26. });
  27.  
  28. // Uruchomienie serwera
  29. app.listen(port, () => {
  30. console.log(`Aplikacja działa na http://localhost:${port}`);
  31. });
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement