I want to create an API that can be called by the app itself (whether "ajax" or server-rendered) and other clients (e.g. mobile app). Most of the articles I found when googling "Quasar REST API" talk about how to access external APIs, which is not my case.
My understanding is to modify src-ssr/extension.js
:
module.exports.extendApp = function({app, ssr}) {
app.get('/api/bla', (req, res) => {
res.send('something')
})
}
and ensure port
inside src-ssr/index.js
:
const ssr = require('../ssr'),
extension = require('./extension'),
app = express(),
port = process.env.PORT || 8888
matches the value in quasar.conf.js
:
devServer: {
https: false,
open: false,
port: 8888,
},
The project builds and runs successfully, but http://localhost:8888/api/bla
keeps loading in the browser. What do I miss?