Express project, how to make each page need to call the api extracted to form a common module to reference?

is like this, every page needs to call some api,. If you write request, on each page, it will feel cumbersome. Is there a good way to write it as a common module, and then introduce a module?


export default axios.get('/commonApi').then(data => {
    return data.data
})
import commonApi from './commonApi'

...

mounted() {
    commonApi.then(data => console.log(data))
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b31d18-2bddc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b31d18-2bddc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?