February 16th 2018
Hello! At the Web Development Bootcamp by Colt Steel we learned about Express framework.
A framework is basically code that someone else wrote, but is it used differently than a library.
Inverstion of Control - the framework calls you, you are not in control, it packages many things, we don't have to focus on the basics stuff every time we make a new application.
Express is a web development framework. It is the most popular node framework. It is a light-weight framework.
Routes are responsible for listening to and receiving requests and sending back.
env. - environment variable, listent to the port
package.json - every npm packages has a package.json
This contains all the metada about the packages relevant for the project, dependencies
--save - will save in the package.json
npm init to create a package.json file
Routing
'*' catch all, if the user goes to a route that in not defined you can predefine a page
Order of routes matters.
app.get("/r/:subredditName", function(req, res){
res.send("WELCOME TO A SUBREDDIT");
});
/: match anything the follows r/ pattern
Cheers!