Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/buzzcosm/ztm-course-projects-nodejs-http-server
Simple HTTP Server
https://github.com/buzzcosm/ztm-course-projects-nodejs-http-server
cors http-server nodejs rest-api ztm ztm-course-exercises
Last synced: about 21 hours ago
JSON representation
Simple HTTP Server
- Host: GitHub
- URL: https://github.com/buzzcosm/ztm-course-projects-nodejs-http-server
- Owner: buzzcosm
- Created: 2024-11-02T12:51:57.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-11-02T22:43:28.000Z (3 months ago)
- Last Synced: 2024-11-23T07:18:08.951Z (2 months ago)
- Topics: cors, http-server, nodejs, rest-api, ztm, ztm-course-exercises
- Language: JavaScript
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# HTTP Server
`ZTM` Udemy Course - [Complete NodeJS Developer](https://www.udemy.com/course/complete-nodejs-developer-zero-to-mastery).
## Prerequisite
- `Node.js` is installed ⚡
- Prefered Code-Editor/IDE is installed (For example: `vscode`) ✍
- Terminal is ready 😎## Description
This project implements a basic HTTP server as a learning exercise, simulating RESTful endpoints for managing a "friends" list. It introduces key HTTP methods, with `GET` requests for viewing the list or individual items and `POST` requests to add new entries. Additionally, the server demonstrates sending both JSON and HTML responses to highlight different content types. The project emphasizes core backend concepts, such as route handling, JSON data handling, and HTTP status codes, making it a useful exercise for understanding foundational web server operations in Node.js.
## Process
Run http-server 🏎️💨
```shell
node index.js
```## Useful references
- [Mozilla - HTTP request methods](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods)
- [What is an API](https://www.mulesoft.com/api/what-is-an-api)
- [Mozilla - HTTP response status codes](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status)
- [Mozilla - Origin](https://developer.mozilla.org/en-US/docs/Glossary/Origin)
- [Mozilla - Same Origin Policy](https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy)
- [Mozilla - Using the Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch)
- [Mozilla - Cross-Origin Resource Sharing (CORS)](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS)
- [Wikipedia - Whitelist](https://en.wikipedia.org/wiki/Whitelist)