generated from fahricansecer/boilerplate-be
20 lines
528 B
JavaScript
20 lines
528 B
JavaScript
const axios = require('axios');
|
|
|
|
async function main() {
|
|
try {
|
|
const login = await axios.post('http://localhost:3000/api/auth/login', {
|
|
email: 'admin@contentgen.ai',
|
|
password: 'admin123'
|
|
});
|
|
const token = login.data.data.accessToken;
|
|
|
|
const res = await axios.get('http://localhost:3000/api/users/me', {
|
|
headers: { Authorization: `Bearer ${token}` }
|
|
});
|
|
console.log(JSON.stringify(res.data, null, 2));
|
|
} catch(e) {
|
|
console.error(e.response?.data || e.message);
|
|
}
|
|
}
|
|
main();
|