Junior — Middle
Share your experience of implementing projects using Node.js.
sobes.tech AI
Answer from AI
In my Node.js projects, I have implemented server-side applications using Express.js to create REST APIs. For example, I developed a task management system where the server handled requests to create, read, update, and delete tasks, interacting with a MongoDB database through Mongoose.
I also used Node.js for writing automation scripts and file processing, thanks to its asynchronous model and a large number of modules.
Here's an example of a simple server using Express.js:
const express = require('express');
const app = express();
app.use(express.json());
app.get('/tasks', (req, res) => {
// logic to retrieve tasks
res.json([{ id: 1, title: 'Sample task' }]);
});
app.listen(3000, () => {
console.log('Server running on port 3000');
});