coding Error
1.
nodemon.ps1
cannot be loaded because running scripts is disabled on this
system. For more information, see about_Execution_Policies at
https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ nodemon app.js
+ ~~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityExce
ption
+ FullyQualifiedErrorId : UnauthorizedAccess
solution:
Open PowerShell (Run As Administrator)
Check the current execution policy using this command
$ Get-ExecutionPolicy
# You should get 'Restricted'
Run this command to make it 'Unrestricted'
$ Set-ExecutionPolicy Unrestricted
2.
app.js (api file)
app.use((req, res, next)=> {
res.setHeader("Access-Control-Allow-Origin", "*");
next();
});