Project Overview
admin and client are react apps generated by
npx nx generate @nx/react:application
for the api
npx nx @nx/node:application
In the context of react, updating the project.json did the thing
project.json
"targets": {
"serve": {
"options": {
"port": 3000
}
}
},
In the api 👇🏽
main.ts
import express from 'express';
import logger from './utils/logger';
const host = process.env.API_HOST ?? 'localhost';
const port = process.env.API_PORT ? Number(process.env.API_PORT) : 5001;
const app = express();
app.use(logger);
app.get('/', (req, res) => {
res.send({ message: 'Hello API' });
});
app.listen(port, host, () => {
console.log(`[ ready ] http://${host}:${port}`);
});
Is there any way to explicitly use the project.json properties for the express server without evnironment-variables?