Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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)