Category : router

I want to get information from the http request and send it to the frontend via the path ‘/ get’. I combined these 2 functions and it works but I don’t think it is correct: const https = require(‘https’); router.get(‘/get’, (req, res) => { https.get(‘https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY’, (resp) => { let data = ”; resp.on(‘data’, (chunk) => ..

Read more

Hi everyone so I have been able to create a post method for uploaded files but I really don’t know how I can get the images in my folder an return it to my client server. router.post(‘/uploads’, upload.single(‘image’), async (request, response) => { const data = await request.files[0].buffer; console.log(request.files[0]); await fs.writeFile(`./uploads/${request.files[0].originalname}`, data); return response.status(200).json({ uploaded: ..

Read more

<Switch> <Route exact path={`${appPath}`} component={asyncDashboard} /> <Route path={`${appPath}FundReleases`} component={asyncFundReleases} /> <Route path={`${appPath}Wizard`} component={asyncWizard} /> </Switch> On the server when I redirect from another app to http://devserver:70/AppName/ , asyncDashboard component renders fine. But when I redirect from another app directly to http://devserver:70/AppName/Wizard, it gives me 404 – File or directory not found. When I load Wizard ..

Read more