Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/m7moudgadallah/express.js-typescript-demo
This is a personal practice project for experimenting with Express.js and TypeScript.
https://github.com/m7moudgadallah/express.js-typescript-demo
Last synced: about 6 hours ago
JSON representation
This is a personal practice project for experimenting with Express.js and TypeScript.
- Host: GitHub
- URL: https://github.com/m7moudgadallah/express.js-typescript-demo
- Owner: m7moudGadallah
- Created: 2023-11-27T17:50:23.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2023-11-27T18:15:05.000Z (12 months ago)
- Last Synced: 2023-11-28T18:52:39.901Z (12 months ago)
- Language: TypeScript
- Size: 55.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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
- [Express.js, TypeScript Demo](#expressjs-typescript-demo)
- [Table of content](#table-of-content)
- [Getting started](#getting-started)
- [Clone the repository](#clone-the-repository)
- [Install dependencies](#install-dependencies)
- [Start the Server](#start-the-server)
- [Usage](#usage)
- [API Endpoints](#api-endpoints)
- [File Structure](#file-structure)## Getting started
### Clone the repository
```bash
git clone
cd Express.js-TypeScript-Demo
```**[↑ Top](#table-of-content)**
### Install dependencies
```bash
npm install
```**[↑ Top](#table-of-content)**
### Start the Server
To start server run this command:
**[↑ Top](#table-of-content)**
```bash
npm run start
```**[↑ Top](#table-of-content)**
## 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](./http/posts.http) file. The rest.http file contains URLs to all endpoints, making it convenient to make requests and test your API.**[↑ Top](#table-of-content)**
## 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](#table-of-content)**
## File Structure
```plaintext
.
├── 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](#table-of-content)**
**_Enjoy the demo!_**