This is a template for creating a REST API using TypeScript, Express, and MySQL.
- TypeScript for type safety and modern JavaScript features
- Express for building the API
- MySQL for the database
- Environment variables for configuration
- Nodemon for development with automatic restarts
- Node.js
- MySQL
-
Clone the repository:
git clone https://github.com/yourusername/your-repo-name.git cd your-repo-name
-
Install dependencies:
npm install
-
Create a
.env
file based on.env.example
and update the values as needed:cp .env.example .env
-
Set up your MySQL database and update the
.env
file with your database credentials.
-
For development:
npm run dev
-
For production:
npm start
- GET /welcome: Get all users.
- GET /welcome/:id: Get a user by ID.
- POST /welcome: Add a new user.
- DELETE /welcome/:id: Delete a user by ID.
- nodemon.json: Configuration for Nodemon.
- tsconfig.json: TypeScript configuration.