This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ curl \ | |
-H "Content-Type: application/json" \ | |
-X DELETE http://localhost:3000/api/users/1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ curl \ | |
-d '{"name": "Karl", "surname":"Marx"}' \ | |
-H "Content-Type: application/json" \ | |
-X PUT http://localhost:3000/api/users/1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"id": 1, | |
"name": "Karl", | |
"surname": "Popper", | |
"created_at": 1638368500000, | |
"updated_at": 1638368500000 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"data": [ | |
{ | |
"id": 1, | |
"name": "Karl", | |
"surname": "Popper", | |
"created_at": 1638368500000, | |
"updated_at": 1638368500000 | |
} | |
], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ curl \ | |
-d '{"name": "Karl", "surname":"Popper"}' \ | |
-H "Content-Type: application/json" \ | |
-X POST http://localhost:3000/api/users |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User extends Model { | |
get fillable() { | |
return ["name", "surname"]; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"data": [], | |
"pagination": { | |
"total": 0, | |
"lastPage": 0, | |
"perPage": 1, | |
"currentPage": 1, | |
"from": 0, | |
"to": 0 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Model } from "axe-api"; | |
class User extends Model {} | |
export default User; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ knex --esm migrate:latest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const up = function(knex) { | |
return knex.schema.createTable("users", function(table) { | |
table.increments(); | |
table.string("name"); | |
table.string("surname"); | |
table.timestamps(); | |
}); | |
}; | |
export const down = function(knex) { |
NewerOlder