Hey this is my index.js code . after updating the code with const [query]⌠I am unable to fetch the local host . and also couldânt terminate the API Call .(tried ctrl+c) . but it takes me back to this.(PS C:\Users\syeds\OneDrive\Desktop\token\dexStarter\dexBack> ).
const express = require(âexpressâ);
const Moralis = require(âmoralisâ).default;
const app = express();
const cors = require(âcorsâ);
require(âdotenvâ).config();
const port = 3001;
app.use(cors());
app.use(express.json());
app.get("/tokenPrice", async (req, res) => {
const {query} =req;
const responseOne=await Moralis.EvmApi.token.getTokenPrice({
address:query.addressOne
})
const responseTwo=await Moralis.EvmApi.token.getTokenPrice({
address:query.addressTwo
})
console.log(responseOne.raw);
console.log(responseTwo.raw);
return res.status(200).json({});
});
Moralis.start({
apiKey: process.env.MORALIS_KEY,
}).then(() => {
app.listen(port, () => {
console.log(`Listening for API Calls`);
});
});
Package.json
{
ânameâ: âdexbackâ,
âversionâ: â1.0.0â,
âdescriptionâ: ââ,
âmainâ: âindex.jsâ,
âscriptsâ: {
"test": "echo \"Error: no test specified\" && exit 1"
},
âkeywordsâ: [],
âauthorâ: ââ,
âlicenseâ: âISCâ,
âdependenciesâ: {
"bigint-buffer": "^1.1.5",
"cors": "^2.8.5",
"dotenv": "^16.0.3",
"express": "^4.18.2",
"moralis": "^2.22.4"
}
}