mirror of
https://github.com/aculix/vector-drawable-nextjs.git
synced 2026-06-12 21:08:35 +00:00
add axios
This commit is contained in:
+13
-7
@@ -1,8 +1,14 @@
|
||||
const axios = require('axios')
|
||||
|
||||
module.exports = (req, res) => {
|
||||
res.json({
|
||||
body: req.body,
|
||||
query: req.query,
|
||||
cookies: req.cookies,
|
||||
});
|
||||
};
|
||||
|
||||
const { method, body, url } = req.body;
|
||||
if (method == 'GET') {
|
||||
const { data } = await axios.get(url);
|
||||
return res.send(data);
|
||||
}
|
||||
|
||||
if (method == 'POST') {
|
||||
const { data } = await axios.post(url, body);
|
||||
return res.send(data);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user