diff --git a/README.md b/README.md index 32c9f1974..862eaa26f 100644 --- a/README.md +++ b/README.md @@ -1,74 +1,76 @@ ## Intro -Welcome to Learning Software Engineering Repository. This is intended as a resource for students new to software engineering to contribute to the ever growing body of knowledge of software engineering by adding/editing their input to help other students learn better. + +Welcome to Learning Software Engineering Repository. This is intended as a resource for students new to software engineering to contribute to the ever growing body of knowledge of software engineering by adding/editing their input to help other students learn better. Readers are expected to know the foundation of software engineering and computer science (e.g., basics of algorithms, foundations of programming). Following files are present in this directory. You may contribute to any of these of your choice. If you are contributing by forming multiple pages, consider structuring your files into a new sub-directory within the topic's directory. Contribute to the readme files within each topic directory as appropriate. ------ +--- Potential Topics-- - Tech stacks - 1. Django - 1. Django Rest Framework + 1. Django + 1. Django Rest Framework + 2. Node.js + 1. Express - Software Tools - 1. Git - 1. Git Workflows + 1. Git + 1. Git Workflows - Software Engineering - 1. Methodologies & Frameworks - 1. Agile - 1. Scrum - 2. Kanban - 3. XP - 2. Waterfall + 1. Methodologies & Frameworks + 1. Agile + 1. Scrum + 2. Kanban + 3. XP + 2. Waterfall - Task management software - 1. Linear.app - 2. Jira - 3. GitHub Projects + + 1. Linear.app + 2. Jira + 3. GitHub Projects - Development Process - 1. GitFlow - 2. Trunk-based Development - 3. Coding Standards - 4. Pull-requests - 5. DevOps - 1. Automated Testing - 1. Unit testings - 2. Integration testing - 2. Build tools - 1. Maven - 2. Gradle - 3. Build requirements - 1. requirements.txt - 2. packages - 4. Deployment - 1. Heroku - 2. AWS - 1. Django Project Deployment: AWS, Vercel and Railway - 3. Firebase - 4. Digital Ocean - 5. Software development best practices: - 6. Vercel Frontend Deployment (Automated) - 1. Designer Patterns - 2. Clean Coding - 1. Choose a coding style and stick to it - 3. SOLID Principles - 4. Code Smells + 1. GitFlow + 2. Trunk-based Development + 3. Coding Standards + 4. Pull-requests + 5. DevOps + 1. Automated Testing + 1. Unit testings + 2. Integration testing + 2. Build tools + 1. Maven + 2. Gradle + 3. Build requirements + 1. requirements.txt + 2. packages + 4. Deployment + 1. Heroku + 2. AWS + 1. Django Project Deployment: AWS, Vercel and Railway + 3. Firebase + 4. Digital Ocean + 5. Software development best practices: + 6. Vercel Frontend Deployment (Automated) + 6. Designer Patterns + 7. Clean Coding + 1. Choose a coding style and stick to it + 8. SOLID Principles + 9. Code Smells - Professionalism - 1. Customer engagement - 1. Meeting best practices - 2. Progress Updates - 2. Communication - 1. Asking questions - 1. Hi everyone, I am working on ____, and I am stuck on ____. I tried ____, it didn’t work because _____. I also tried _____, and it didn’t work because ____. I am assuming _____ and ____. Does anyone have any hints as to what might be wrong? - 3. Presentations - - + 1. Customer engagement + 1. Meeting best practices + 2. Progress Updates + 2. Communication + 1. Asking questions + 1. Hi everyone, I am working on \_**\_, and I am stuck on \_\_**. I tried \_**\_, it didn’t work because \_\_\_**. I also tried **\_**, and it didn’t work because \_**\_. I am assuming \_\_\_** and \_\_\_\_. Does anyone have any hints as to what might be wrong? + 3. Presentations - User Experience - 1. Overview - 2. Areas of User Experience - 3. Helpful Courses + 1. Overview + 2. Areas of User Experience + 3. Helpful Courses - Product Management - 1. Beginner's guide to product management and becoming a successful product manager + 1. Beginner's guide to product management and becoming a successful product manager - Other useful resources - Teamwork diff --git a/Topics/Tech_Stacks.md b/Topics/Tech_Stacks.md index d37422b95..131ac5f02 100644 --- a/Topics/Tech_Stacks.md +++ b/Topics/Tech_Stacks.md @@ -1,6 +1,11 @@ ## Tech Stacks ### [Learning MySQL for databases](./Tech_Stacks/Learning_MySQL.md) + ### [How to access and use salesforce API](./Tech_Stacks/salesforce_api.md) + ### [React Resources](./Tech_Stacks/React.md) + ### [Angular Resources](./Tech_Stacks/Angular.md) + +### [Express Resources](./Tech_Stacks/Express.md) diff --git a/Topics/Tech_Stacks/Express.md b/Topics/Tech_Stacks/Express.md new file mode 100644 index 000000000..dd16f9f07 --- /dev/null +++ b/Topics/Tech_Stacks/Express.md @@ -0,0 +1,144 @@ +# Setting up a Basic RESTful Server with Node.js and Express + +## Table of contents + +### [Introduction](#introduction-1) + +### [Prerequisites](#prerequisites-1) + +### [Setting up the project](#setting-up-the-project-1) + +### [Installing Express](#installing-express-1) + +### [Creating a basic server](#creating-a-basic-server-1) + +### [Defining RESTful routes](#defining-restful-routes-1) + +### [Additional Resources](#additional-resources-1) + +## Introduction + +This guide will help you set up a simple RESTful server using Express, a popular web framework for Node.js. We will create a basic server that listens for HTTP requests and sends responses. + +## Prerequisites + +[Node.js](https://nodejs.org/en/download) \ +[npm](https://www.npmjs.com/package/npm) + +## Setting up the project + +[Express Getting Started](https://expressjs.com/en/starter/installing.html) + +First, let's create a new directory for our project and navigate to it using the terminal. + +```bash +mkdir express-server +cd express-server +``` + +Now, initialize the project with the `npm init` command. Follow the prompts or use `npm init -y` to accept the defaults. + +```bash +npm init -y +``` + +## Installing Express + +To install Express, run the following command: + +```bach +npm install express +``` + +## Creating a basic server + +Create a new file named `app.js` in the project directory and add the following code: + +```javascript +const express = require("express"); +const app = express(); +const PORT = process.env.PORT || 3000; + +app.get("/", (req, res) => { + res.send("Hello, World!"); +}); + +app.listen(PORT, () => { + console.log(`Server is running on port ${PORT}`); +}); +``` + +This code imports the Express library, creates an instance of it, and sets up a basic server that listens on port 3000. + +## Defining RESTful routes + +Next, we'll define some RESTful routes for a simple resource. For this example, we'll use an in-memory array to represent a list of items. + +Add the following code to `app.js`: + +```javascript +const items = []; + +app.use(express.json()); + +app.get("/items", (req, res) => { + res.json(items); +}); + +app.post("/items", (req, res) => { + const newItem = req.body; + items.push(newItem); + res.status(201).json(newItem); +}); + +app.get("/items/:id", (req, res) => { + const id = parseInt(req.params.id); + const item = items.find((i) => i.id === id); + + if (!item) { + return res.status(404).json({ error: "Item not found" }); + } + + res.json(item); +}); + +app.put("/items/:id", (req, res) => { + const id = parseInt(req.params.id); + const index = items.findIndex((i) => i.id === id); + + if (index === -1) { + return res.status(404).json({ error: "Item not found" }); + } + + items[index] = req.body; + res.json(items[index]); +}); + +app.delete("/items/:id", (req, res) => { + const id = parseInt(req.params.id); + const index = items.findIndex((i) => i.id === id); + + if (index === -1) { + return res.status(404).json({ error: "Item not found" }); + } + + const deletedItem = items.splice(index, 1)[0]; + res.json(deletedItem); +}); +``` + +We have defined the following routes for our items resource: + +`GET /items`: Retrieve all items \ +`POST /items`: Create a new item \ +`GET /items/:id`: Retrieve a specific item by ID \ +`PUT /items/:id`: Update an existing item by ID \ +`DELETE /items/:id`: Delete an item by ID \ +The `app.use(express.json());` line tells Express to parse incoming JSON payloads, allowing us to access the request body data. + +## Additional Resources + +[Official Reference](https://expressjs.com/en/4x/api.html) \ +[GitHub Page](https://github.com/expressjs/express) \ +[MDN Express Example](https://developer.mozilla.org/en-US/docs/Learn/Server-side/Express_Nodejs) \ +[Tutorialspoint](https://www.tutorialspoint.com/nodejs/nodejs_express_framework.htm)