Essential ruby questions on Stack Overflow:
When I first started using Ruby on Rails, I did not have a deep understanding of how hashes worked or the difference between keys that are symbols (:my_key) and keys which are strings ('my_other_key'). I assumed wrongly that symbols were simply aliases of strings that the following lines of code were equivalent:
my_hash['key'] = 'my value'
my_hash[:key] = 'my value'They aren't, of course. Those two lines of code establish two different key / value pairs. And if you print the my_hash, you get this:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const express = require('express'); | |
| const app = express(); | |
| // port for local dev server | |
| const port = 3000; | |
| // for css/js/img assets and for any static files | |
| app.use(express.static("public")); | |
| // using ejs html templates in the views/ folder |