Skip to content

This is a personal practice project for experimenting with Express.js and TypeScript.

Notifications You must be signed in to change notification settings

m7moudGadallah/Express.js-TypeScript-Demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Express.js, TypeScript Demo

This is a personal practice project for experimenting with Express.js and TypeScript.

Please note that this demo doesn't use a database. Instead, it loads sample data from a JSON file when the server starts. The project includes a model class that performs CRUD operations on this data.

Table of content

Getting started

Clone the repository

 git clone <repository-url>
 cd Express.js-TypeScript-Demo

↑ Top

Install dependencies

npm install

↑ Top

Start the Server

To start server run this command:

↑ Top

npm run start

↑ Top

Usage

  • Use your preferred API client (e.g., Postman, curl) to interact with the API.
  • Alternatively, you can use the REST Client extension in Visual Studio Code to test the API directly from the provided posts.http file. The rest.http file contains URLs to all endpoints, making it convenient to make requests and test your API.

↑ Top

API Endpoints

  • GET /api/posts - Get all posts
  • GET /api/posts/:id - Get a single post
  • POST /api/posts - Create a new post
  • PATCH /api/posts/:id - Update a post
  • DELETE /api/posts/:id - Delete a post

↑ Top

File Structure

.
├── data
│   ├── index.ts
│   └── posts.json
├── http
│   ├── monitoring.http
│   └── posts.http
├── package.json
├── package-lock.json
├── README.md
└── src
    ├── app.ts
    ├── controllers
    │   ├── apiMonitoring.controller.ts
    │   ├── index.ts
    │   └── posts.controller.ts
    ├── dtos
    │   ├── index.ts
    │   └── posts.dto.ts
    ├── interfaces
    │   ├── index.ts
    │   ├── jsonResponse.interface.ts
    │   └── post.interface.ts
    ├── models
    │   ├── index.ts
    │   └── posts.model.ts
    ├── routes
    │   ├── apiMonitoring.routes.ts
    │   ├── index.ts
    │   └── posts.routes.ts
    └── utils
        ├── enums
        │   ├── HttpStatusCode.enum.ts
        │   └── index.ts
        └── helpers
            ├── index.ts
            └── notImplementedHandler.helper.ts

↑ Top

Enjoy the demo!

About

This is a personal practice project for experimenting with Express.js and TypeScript.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published