https://github.com/guidefari/mail-bag
https://github.com/guidefari/mail-bag
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/guidefari/mail-bag
- Owner: guidefari
- Created: 2020-10-09T21:22:14.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-10-10T14:09:21.000Z (over 5 years ago)
- Last Synced: 2025-04-02T02:44:27.930Z (over 1 year ago)
- Language: TypeScript
- Size: 35.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Notes
`www.mysite.com/users/add` - The word add is a verb, which makes this a non-RESTful URL. Only nouns go into the
URL because nouns describe things or states of things
```js
const app = express();
app.get("/cars/:vin", function(inRequest, inResponse) {
// Return a car object with the specific VIN number
});
app.listen(8080);
```
> vin (which you can then access in the function by doing inRequest.params.vin).
`app.use(express.json());` - This middleware takes care of parsing incoming request bodies that contain JSON,
as many of ours will. Our application code will, thanks to this middleware, receive a
JavaScript object resulting from the incoming data, saving us the hassle of parsing it
ourselves.
## resources consumed
- A word on [ES6 classes](https://youtu.be/RBLIm5LMrmc?list=WL) - Brad Traversy.