* Expanded the solution for the 'Get Route Parameter Input from the Client' challenge * Expanded the guide for the 'Use body-parser to Parse POST Requests' challenge * Rewritten guide for the 'Serve JSON on a Specific Route' challenge and fixed source link * Expanded the guide for the 'Serve Static Assets' challenge * Expanded solution to the 'Get Query Parameter Input from the Client' challenge and fixed links to source file * Added solution to the 'Chain Middleware to Create a Time Server' challenge and fixed link to source file * Rewrite the 'Start a Working Express Server' challenge * Expanded the guide for 'Expand Your Project with External Packages from npm' * Added reference to semantic versioning in 'Add a Version to Your package.json' * fix/remove-links+fix-solutions * fix/remove-more-links
643 B
643 B
title
title |
---|
Start a Working Express Server |
Start a Working Express Server
If you had a website at "example.com/" and wanted to serve a string such as "Hello Express" to whoever visits the root domain you could do so easily using Node and/or express:
app.get("/", function(req, res) {
res.send("Hello Express");
});
Also, with the modern ES6 syntax you can save a few keystrokes by using arrow functions:
app.get("/", (req, res) => {
res.send("Hello Express");
});