Skip to content

CodeCoachJS/js_pros_backend_starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Basic Express.js Backend App

This simple backend application, built with Express.js, demonstrates how to set up a basic server, handle routes, and use middleware like CORS. The app fetches user data based on an ID, illustrating how to work with basic HTTP requests and responses.

Getting Started

Prerequisites

  • Node.js installed on your machine. If you don't have it, you can download it here.
  • Basic knowledge of JavaScript and familiarity with HTTP requests.

Installation

  1. Clone the repository or download the source files.
  2. Open your terminal and navigate to the project directory.
  3. Install the dependencies:
    npm install express cors

Running the Server

  1. Start the server by running:
    node index.js
  2. The server will start on http://localhost:8000.

Endpoints

GET /:id

This route fetches user data based on the id parameter.

  • Request:

    GET http://localhost:8000/1

    Replace 1 with any valid user ID (e.g., 2 or 3).

  • Response: If the user is found, you'll get a JSON response like this:

    {
    	"user": {
    		"id": 1,
    		"name": "John Doe"
    	}
    }

    If the user is not found, you'll receive a 404 response:

    {
    	"message": "User not found"
    }

Learning Path

If this project is outside of your current skill set, consider joining Dev30. Dev30 is a fantastic program designed to help you learn JavaScript, work with a community of developers, and complete hands-on projects that build a solid foundation for entering the world of software engineering.

JOIN DEV_30 HERE

Video Tutorial

Follow along with this video tutorial to get more detailed instructions on setting up and understanding the basics of this project.

Want more of a challenge?

Check out Node/Express Advanced

About

The most basic backend app with node express. Mean to be followed with this video: https://youtu.be/9mU6Mnq9ZXY?si=0xdi7YocQMvI3npV

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published