Sobes.tech
Junior — Middle

How many different APIs have you created using Express?

sobes.tech AI

Answer from AI

The number of APIs created using Express depends on the projects I have participated in. Usually, in small projects, I have created from 2 to 5 different APIs covering various functional areas, such as authentication, user data management, order processing, etc. In larger projects, APIs can be more extensive and modular.

Example of a simple API on Express:

const express = require('express');
const app = express();

app.use(express.json());

app.get('/api/users', (req, res) => {
  res.json([{ id: 1, name: 'Ivan' }, { id: 2, name: 'Maria' }]);
});

app.post('/api/users', (req, res) => {
  const user = req.body;
  // logic to add a user
  res.status(201).json(user);
});

app.listen(3000, () => console.log('Server running on port 3000'));