V3X4TI0US
V3X4TI0US
KPCKevin Powell - Community
Created by V3X4TI0US on 6/6/2024 in #front-end
NextJS Api Calls
Backend is working just fine
3 replies
KPCKevin Powell - Community
Created by V3X4TI0US on 6/6/2024 in #front-end
NextJS Api Calls
const pool = require('./connection.js')
const express = require('express');
const app = express();
const cors = require("cors");
const bodyParser = require("body-parser");

app.use(express.json());
app.use(
cors({
origin: "http://localhost:5173",
methods: "GET,POST,PUT,DELETE",
credentials: true,
})
);

app.use(bodyParser.json());


// Route handler for the root URL
app.get('/', (req, res) => {
res.send('Welcome to the Q&A API');
});


// GET ALL QUESTIONS
app.get("/questions", async (req, res) => {
const selectQuery = `
SELECT * FROM questions q INNER JOIN answers a
ON q.question_id = a.question_id
`;

try {
const { rows } = await pool.query(selectQuery);
res.json({ rows });
const questions = rows
console.log(questions[0])
} catch (error) {
console.error(error);
res.status(500).json({ error: "Internal Server Error" });
}
});
const pool = require('./connection.js')
const express = require('express');
const app = express();
const cors = require("cors");
const bodyParser = require("body-parser");

app.use(express.json());
app.use(
cors({
origin: "http://localhost:5173",
methods: "GET,POST,PUT,DELETE",
credentials: true,
})
);

app.use(bodyParser.json());


// Route handler for the root URL
app.get('/', (req, res) => {
res.send('Welcome to the Q&A API');
});


// GET ALL QUESTIONS
app.get("/questions", async (req, res) => {
const selectQuery = `
SELECT * FROM questions q INNER JOIN answers a
ON q.question_id = a.question_id
`;

try {
const { rows } = await pool.query(selectQuery);
res.json({ rows });
const questions = rows
console.log(questions[0])
} catch (error) {
console.error(error);
res.status(500).json({ error: "Internal Server Error" });
}
});
Here is a basic route inside my api.js file which inside my server folder
3 replies
KPCKevin Powell - Community
Created by V3X4TI0US on 10/20/2023 in #front-end
CSS text-overflow: ellipsis not working
Thanks for your help.
35 replies
KPCKevin Powell - Community
Created by V3X4TI0US on 10/20/2023 in #front-end
CSS text-overflow: ellipsis not working
I did make it work, i added display block to title and description for ellipsis to work, and for the centering, i used text align center and padding 1 rem, which works because its relative to my font.
35 replies
KPCKevin Powell - Community
Created by V3X4TI0US on 10/20/2023 in #front-end
CSS text-overflow: ellipsis not working
The reason i implemented grid from flexbox is because grid works for column and rows. I need to figure out something else to make it work.
35 replies
KPCKevin Powell - Community
Created by V3X4TI0US on 10/20/2023 in #front-end
CSS text-overflow: ellipsis not working
Okay, np.
35 replies
KPCKevin Powell - Community
Created by V3X4TI0US on 10/20/2023 in #front-end
CSS text-overflow: ellipsis not working
after doing this, i got this result.
35 replies
KPCKevin Powell - Community
Created by V3X4TI0US on 10/20/2023 in #front-end
CSS text-overflow: ellipsis not working
No description
35 replies
KPCKevin Powell - Community
Created by V3X4TI0US on 10/20/2023 in #front-end
CSS text-overflow: ellipsis not working
so you mean wrap the description span with another element?
35 replies
KPCKevin Powell - Community
Created by V3X4TI0US on 10/20/2023 in #front-end
CSS text-overflow: ellipsis not working
I tried to add display block to #description and it worked but I lost my flex properties
35 replies
KPCKevin Powell - Community
Created by V3X4TI0US on 10/20/2023 in #front-end
CSS text-overflow: ellipsis not working
oh. Okay I will tell what i tried.
35 replies
KPCKevin Powell - Community
Created by V3X4TI0US on 10/20/2023 in #front-end
CSS text-overflow: ellipsis not working
also, i didnt quiet understand what you meant here.
35 replies
KPCKevin Powell - Community
Created by V3X4TI0US on 10/20/2023 in #front-end
CSS text-overflow: ellipsis not working
can u check it again?
35 replies
KPCKevin Powell - Community
Created by V3X4TI0US on 10/20/2023 in #front-end
CSS text-overflow: ellipsis not working
35 replies
KPCKevin Powell - Community
Created by V3X4TI0US on 10/20/2023 in #front-end
CSS text-overflow: ellipsis not working
i dont know what should I do to make it work
35 replies
KPCKevin Powell - Community
Created by V3X4TI0US on 10/20/2023 in #front-end
CSS text-overflow: ellipsis not working
not working, it applies flex but not the ellipsis.
35 replies
KPCKevin Powell - Community
Created by V3X4TI0US on 10/20/2023 in #front-end
CSS text-overflow: ellipsis not working
oh no, actually the previous design used wrapper divs, but to improve the code , i used grids.
35 replies
KPCKevin Powell - Community
Created by V3X4TI0US on 10/20/2023 in #front-end
CSS text-overflow: ellipsis not working
i used flexbox to vertically and horizontally center align them
35 replies
KPCKevin Powell - Community
Created by V3X4TI0US on 10/20/2023 in #front-end
CSS text-overflow: ellipsis not working
Hey, it did work, but then my description span has no flex properties now
35 replies
KPCKevin Powell - Community
Created by V3X4TI0US on 10/20/2023 in #front-end
CSS text-overflow: ellipsis not working
because in the ss u shared, it works only for description
35 replies