DeveloperBreeze

Simple RESTful API in Node.js using Express

javascript
// Import 'express' module
const express = require('express');
const app = express();

// Define a route for accessing a resource
app.get('/api/resource', (req, res) => {
  res.json({ message: 'Resource data' });
});

// Start the server and listen on port 3000
app.listen(3000, () => {
  console.log('RESTful API is running on port 3000');
});

Continue Reading

Handpicked posts just for you — based on your current read.

Discussion 0

Please sign in to join the discussion.

No comments yet. Start the discussion!