### Instruction:
Create a Node.js web server that serves static files from a specified directory and provides RESTful API endpoints for CRUD operations on a "Task" model (with fields like title, description, due date) stored in a PostgreSQL database.


### Response:

To create a Node.js web server that serves static files and provides RESTful API endpoints for CRUD operations on a "Task" model, you'll need to follow these steps:

1. Install required dependencies
2. Set up the PostgreSQL database
3. Create the Express app and set up middleware
4. Serve static files
5. Define the Task model
6. Create API routes for CRUD operations
7. Start the server

Here's an example implementation:

```javascript
// 1. Install required dependencies
const express = require('express');
const path = require('path');
const bodyParser = require('body-parser');
const { Pool } = require('pg');

// 2. Set up the PostgreSQL database
const pool = new Pool({
  user: 'your_user',
  host: 'localhost',
  database: 'your_database',
  password: 'your_password',
  port: 5432,
});

// 3. Create the Express app and set up middleware
const app = express();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));

// 4. Serve static files
app.use(express.static(path.join(__dirname, 'public')));

// 5. Define the Task model
class Task {
  constructor(id, title, description, due_date) {
    this.id = id;
    this.title = title;
    this.description = description;
    this.due_date = due_date;
  }

  static async getAll() {
    const res = await pool.query('SELECT * FROM tasks ORDER BY id ASC');
    return res.rows.map((row) => new Task(row.id, row.title, row.description, row.due_date));
  }

  static async getById(id) {
    const res = await pool.query('SELECT * FROM tasks WHERE id = $1', [id]);
    if (res.rowCount === 0) return null;
    const row = res.rows[0];
    return new Task(row.id, row.title, row.description, row.due_date);
  }

  async save() {
    if (this.id) {
      await pool.query('UPDATE tasks SET title = $1, description = $2, due_date = $3 WHERE id = $4', [
        this.title,
        this.description,
        this.due_date,
        this.id,
      ]);
    } else {
      const res = await pool.query('INSERT INTO tasks (title, description, due_date) VALUES ($1, $2, $3) RETURNING id', [
        this.title,
        this.description,
        this.due_date,
      ]);
      this.id = res.rows[0].id;
    }
  }

  async delete() {
    await pool.query('DELETE FROM tasks WHERE id = $1', [this.id]);
  }
}

// 6. Create API routes for CRUD operations
app.get('/api/tasks', async (req, res) => {
  const tasks = await Task.getAll();
  res.json(tasks);
});

app.post('/api/tasks', async (req, res) => {
  const task = new Task(null, req.body.title, req.body.description, req.body.due_date);
  await task.save();
  res.status(201).json(task);
});

app.put('/api/tasks/:id', async (req, res) => {
  const task = await Task.getById(req.params.id);
  if (!task) return res.sendStatus(404);

  task.title = req.body.title;
  task.description = req.body.description;
  task.due_date = req.body.due_date;
  await task.save();

  res.json(task);
});

app.delete('/api/tasks/:id', async (req, res) => {
  const task = await Task.getById(req.params.id);
  if (!task) return res.sendStatus(404);

  await task.delete();
  res.sendStatus(204);
});

// 7. Start the server
const port = process.env.PORT || 3000;
app.listen(port, () => {
  console.log(`Server is running on port ${port}`);
});
```

Before running this code, make sure to create a `public` directory in your project folder for serving static files.

Also, don't forget to install the required dependencies by running:

```bash
npm init -y
npm install express body-parser pg
```

And replace the PostgreSQL connection parameters with your own credentials.

Finally, you'll need to create a table called "tasks" in your PostgreSQL database with the following schema:

```sql
CREATE TABLE tasks (
  id SERIAL PRIMARY KEY,
  title VARCHAR(255) NOT NULL,
  description TEXT,
  due_date DATE
);
```

Now you can run your Node.js web server using `node app.js`, and it will serve static files from the `public` directory and provide RESTful API endpoints for CRUD operations on the Task model stored in the PostgreSQL database.