3bdoYasser / simple-test

0 stars 0 forks source link

OpenStack-ai: test #2

Open 3bdoYasser opened 11 months ago

3bdoYasser commented 11 months ago

create nodejs project with MVC architecture.

openstack-ai[bot] commented 11 months ago

Make Pull Request...

CREATE package.json

{
  "name": "simple-test",
  "version": "1.0.0",
  "description": "",
  "main": "app.js",
  "scripts": {
    "start": "node app.js"
  },
  "dependencies": {
    "express": "^4.17.1"
  }
}

CREATE app.js

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

app.listen(port, () => {
  console.log(`App running on http://localhost:${port}`);
});

CREATE controllers/testController.js

exports.test = (req, res) => {
  res.send('Hello World!');
};

CREATE routes/testRoute.js

const express = require('express');
const testController = require('../controllers/testController');
const router = express.Router();

router.get('/', testController.test);

module.exports = router;

UPDATE app.js

const express = require('express');
const testRoute = require('./routes/testRoute');
const app = express();
const port = 3000;

app.use('/', testRoute);

app.listen(port, () => {
  console.log(`App running on http://localhost:${port}`);
});

CREATE .gitignore

node_modules/

CREATE README.md

# simple-test

This is a simple Node.js application with MVC architecture.

## Installation

1. Clone the repository.
2. Run `npm install` to install the dependencies.
3. Run `npm start` to start the application.

CREATE models/testModel.js

// This file is intentionally left blank as a placeholder for future model definitions.