URL params and query strings

master
Matt Huntington 9 years ago
parent f771c37ccb
commit eca5c142d9

@ -147,10 +147,29 @@ Now inside the .ejs file, we can access `variable1Name` like so:
Value: <%= variable1Name; %> Value: <%= variable1Name; %>
``` ```
## Params/Query Strings ## URL Params/Query Strings
## REST
## Middleware Data can be passed to the server through query strings (a.ka. GET parameters) which look like ?param1=value1&param2=value2
They can be accessed like so:
```javascript
app.get('/', function(req, res){
var param1 = req.query.param1;
var param2 = req.query.param2;
});
```
Your route can also have parameters in the path section
```javascript
app.get('/:id', function(req, res){
var id = req.params.id;
});
```
## Body Parser ## Body Parser
## REST
## Method Override ## Method Override
## Database ## Database
## Static ## Static

Loading…
Cancel
Save