← Back to Blog

I might be in love

I might be in love Javascript is easier to manage!

I might be in love

i might be 1

Javascript is easier to manage!

https://chat.openai.com/share/a655cf13-34b1-4219-9171-6bd7c0ec1620

i might be 2

devops and module name is important

i might be 3

const cheerio = require('cheerio');
                
                module.exports = async function (context, req) {
                    context.log('JavaScript HTTP trigger function processed a request.');
                
                    const htmlContent = `
                        <!DOCTYPE html>
                        <html>
                        <head>
                            <title>DevOps Job Offer</title>
                        </head>
                        <body>
                            <h1>DevOps Engineer Job Offer</h1>
                            <p>We are hiring for a DevOps Engineer position. Here are some details:</p>
                            <ul>
                                <li>Position: DevOps Engineer</li>
                                <li>Type: Full-time</li>
                                <li>Location: Remote</li>
                            </ul>
                            <p>We offer competitive compensation and benefits. If you are interested, please apply through one of the following links:</p>
                            <ul>
                                <li><a href="https://example.com/apply">Apply Now</a></li>
                                <li><a href="https://example.com/careers">Explore other opportunities</a></li>
                            </ul>
                        </body>
                        </html>
                    `;
                
                    function extractLinks(htmlContent) {
                        const $ = cheerio.load(htmlContent);
                        const links = &#091;];
                
                        $('a').each((index, element) => {
                            const href = $(element).attr('href');
                            if (href) {
                                links.push(href);
                            }
                
                        return links;
                    }
                
                    const extractedLinks = extractLinks(htmlContent);
                
                    if (extractedLinks.length > 0) {
                        context.res = {
                            body: extractedLinks
                    } else {
                        context.res = {
                            status: 404,
                            body: "No links found."
                    }
                
                


Imported from rifaterdemsahin.com · 2024