02 - Start a Working Express Server - Basic Node and Express - freeCodeCamp Tutorial
Ganesh H
We look at how to create an Express server app, and set up a basic route to return a string. We can import express with require(), call express() to create an app, start the server by calling listen() with a port number. A GET route can be set with app.get(), giving a path and a function to run.
Link to challenge : https://www.freecodecamp.org/learn/apis-and-microservices/basic-node-and-express/start-a-working-express-server Written Guide : https://www.notion.so/ganeshh123/Start-a-Working-Express-Server-64744bea49c446d3abd3931147c8e8c2
Full Playlist for this course : https://www.youtube.com/playlist?list=PLhGp6N0DI_1SdIZ3uhbXnKAq2UcICSnWS All Writen Guides for this course : https://www.notion.so/ganeshh123/dab5e189407244c793c2f32d066eee9f All My Tutorials can be found at : https://www.notion.so/Tutorials-Ganesh-H-293ea420d34a464f9a1907e0405b5f26
Concepts: require() Used to import modules, JSON, and local files. Modules can be imported from node_modules. https://nodejs.org/api/modules.html#modules_require_id
express() Creates an Express application. The express() function is a top-level function exported by the express module. https://expressjs.com/en/5x/api.html
app.listen() Binds and listens for connections on the specified host and port. This method is identical to Node’s http.Server.listen(). If port is omitted or is 0, the operating system will assign an arbitrary unused port, which is useful for cases like automated tasks (tests, etc.). https://expressjs.com/en/5x/api.html#app.listen
app.get() Routes HTTP GET requests to the specified path with the specified callback functions. https://expressjs.com/en/5x/api.html#app.get.method
-————————————————————————————————————- Node.js is an open-source, cross-platform, JavaScript runtime environment that executes JavaScript code outside a web browser. Node.js lets developers use JavaScript to write command line tools and for server-side scripting—running scripts server-side to produce dynamic web page content before the page is sent to the user's web browser.
Express.js, or simply Express, is a web application framework for Node.js. It is designed for building web applications and APIs. It has been called the de facto standard server framework for Node.js. Express runs between the server created by Node.js and the frontend pages of a web application. Express also handles an application's routing.
freeCodeCamp (also referred to as “Free Code Camp”) is a non-profit organization that consists of an interactive learning web platform, an online community forum, chat rooms, online publications and local organizations that intend to make learning web development accessible to anyone. Beginning with tutorials that introduce ... https://www.youtube.com/watch?v=CywCbn4Y6r8
30878566 Bytes