-
Notifications
You must be signed in to change notification settings - Fork 73
Fixed some issues in relation to http headers, profile links and proxies #220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed some issues in relation to http headers, profile links and proxies #220
Conversation
Deploy preview for codeuino processing. Building with commit 4f68ea2 https://app.netlify.com/sites/codeuino/deploys/5f5c875817de2b00070645ce |
I changed various props name to standard version which removes most errors during development. For instance, changed tabindex to TabIndex and class to className. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
made comments to the areas where I made changes
@@ -1,14 +1,14 @@ | |||
const axios = require("axios"); | |||
const xml2js = require("xml2js"); | |||
|
|||
exports.handler = async (event, context, callback) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The callback wasn't needed since the async keyword was used. This helps prevent some errors
const mediumURL = "https://medium.com/feed/codeuino"; | ||
try { | ||
const response = await axios.get(`${mediumURL}`); | ||
const data = response.data; | ||
xml2js.parseString(data, (err, result) => { | ||
const sendthis = result.rss.channel[0].item.slice(0, 3); | ||
callback(null, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
had to use the return keyword because the async keyword was used to instantiate the function
@@ -53,7 +54,7 @@ | |||
"scripts": { | |||
"lambda-serve": "netlify-lambda serve netlify-functions", | |||
"heroku-postbuild": "npm run build", | |||
"start": "serve -s build -l 3000", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needed to also run the lambda function to ensure communication to serverless function is possible
@@ -1,3 +1,2 @@ | |||
export default process.env.NODE_ENV === "development" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
had to use "/.netlify/functions" because a proxy file was created
linkedin: "" | ||
linkedin: "https://www.linkedin.com/in/jaskiratsingh2000/" | ||
}, | ||
{ | ||
name: "Devesh", | ||
post: "Donut Maintainer", | ||
headline: | ||
"foss contributor|board member@CODEUINO|software engineer@SHAW ACADEMY|ex-intern@SHAW ACADEMY|HASURA| INTERNSHALA|HIREINK|INDICIUMHUB|", | ||
profile: devesh, | ||
github: "", | ||
linkedin: "" | ||
github: "https://github.com/devesh-verma", | ||
linkedin: "https://www.linkedin.com/in/devesh-verma/" | ||
}, | ||
{ | ||
name: "Vaibhav D. Aren", | ||
post: "Board Member", | ||
headline: | ||
"SDE at HashedIn | GSOC 2018 Developer @SugarLabs | GSOC-19 Mentor @JBOSS(Codeuino)| GCI -18 Mentor @SugarLabs .", | ||
profile: vaibhav, | ||
github: "", | ||
linkedin: "" | ||
github: "https://github.com/vaibhavdaren", | ||
linkedin: "https://www.linkedin.com/in/vaibhavdaren/" | ||
}, | ||
{ | ||
name: "Ayush Nagar", | ||
post: "CodeBadge Maintainer", | ||
headline: "Student Mentor at Google Code-in", | ||
profile: "https://avatars1.githubusercontent.com/u/32647423?s=460&v=4", | ||
github: "https://github.com/ayushnagar123", | ||
linkedin: "" | ||
linkedin: "https://www.linkedin.com/in/ayushnagar123/" | ||
}, | ||
{ | ||
name: "Siddharth", | ||
post: "Designer", | ||
headline: "Student Mentor at Google Code-in", | ||
profile: "https://avatars1.githubusercontent.com/u/33068322?s=460&v=4", | ||
github: "", | ||
linkedin: "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added profile links for GitHub and LinkedIn
@sammychinedu2ky can you resolve these conflicts |
const {createProxyMiddleware} = require('http-proxy-middleware') | ||
// this proxy code allows the use of .netlify/function in both development and production | ||
module.exports = function(app){ | ||
app.use( | ||
createProxyMiddleware( | ||
"/.netlify/functions", { | ||
target: "http://localhost:9000", | ||
pathRewrite: { | ||
'^/\\.netlify/functions': '' | ||
} | ||
} | ||
) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Proxy file to redirect all request from /.netlify/functions to http://localhost:9000 .
This ensures that netlify function works in both build state of local project and the preview mode of netlify during a pull request
accepted change change to package.json set the key prop properly centered headers added key prop proxy:localdev
Added links to the profile sections of teams in the https://www.codeuino.org/#/team
Fixed issue in the netlify functions. The callback keyword wasn't needed since the async keyword was used and this made it return Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
So I resolved these issues