Get list of users
(None) |
Name | Type | Description |
---|---|---|
(Returns) | Array<Object> | list of users |
name | String | user's name |
age | Number | user's age |
app.get('/users', (req, res) => { res.json([ { name: 'John Doe', age: 30 }, { name: 'Bill Smith', age: 23 }, ]); });
Create a new user
Name | Type | Description |
---|---|---|
name | String | user's name |
age | Number | user's age |
Name | Type | Description |
---|---|---|
(Returns) | Object | information of created user |
id | Number | user record ID |
app.post('/users', (req, res) => { res.json({ id: 1 }); }); app.listen(3000);