Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/faisal-din/twitter_posts_project
https://github.com/faisal-din/twitter_posts_project
backend express express-js express-middleware nodejs nodejs-server nodemon rest-api restful-api
Last synced: 17 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/faisal-din/twitter_posts_project
- Owner: faisal-din
- Created: 2024-10-26T18:53:16.000Z (20 days ago)
- Default Branch: main
- Last Pushed: 2024-10-26T19:05:06.000Z (20 days ago)
- Last Synced: 2024-10-26T21:13:15.962Z (20 days ago)
- Topics: backend, express, express-js, express-middleware, nodejs, nodejs-server, nodemon, rest-api, restful-api
- Language: EJS
- Homepage:
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Code Breakdown
## 1. Controller: controllers/postsController.js
The postsController.js file handles the logic for creating, reading, updating, and deleting posts.
## 2. Middleware: middlewares/methodOverride.js
The methodOverride.js file sets up method override for handling forms that need to send PATCH and DELETE requests.
## 3. Routes: routes/postsRoutes.js
The postsRoutes.js file defines each route and maps it to the appropriate controller function.
## 4. Main Server File: app.js
The app.js file initializes the Express application, configures middleware, sets up views, and mounts the routes.
## Views (EJS Templates)
Views folder contains EJS templates (index.ejs, new.ejs, show.ejs, and edit.ejs).
## Public Folder
It contains style.css file.
P.s: This setup allows you to serve static assets like CSS and JavaScript files easily.