Apprendre à créer des API Avec Django
https://books.agiliq.com/projects/django-api-polls-tutorial/en/latest/
https://github.com/dbrgn/drf-dynamic-fields
https://florimondmanca.github.io/djangorestframework-api-key/
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>onload() {
//axios.defaults.xsrfCookieName = 'csrftoken'
//axios.defaults.xsrfHeaderName = 'X-CSRFToken'
axios.get('url')
.then(response => {
console.log(response.data)
})
.catch((err) => {
console.log(err);
})
},
submituser: function () {
axios.defaults.xsrfCookieName = 'csrftoken'
axios.defaults.xsrfHeaderName = 'X-CSRFToken'
axios.post('http://127.0.0.1:8001/post', {
name: '' + this.name,
username: '' + this.username,
email: '' + this.email,
password: '' + this.password,
}).then(response => {
console.log(response)
})
.catch((err) => {
console.log(err);
})
}