Skip to content

This is a template for creating a REST API using TypeScript, Express, and MySQL.

Notifications You must be signed in to change notification settings

SamElfring/Typscript-Express-MySQL-api-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TypeScript Express MySQL API Template

This is a template for creating a REST API using TypeScript, Express, and MySQL.

Features

  • 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

Getting Started

Prerequisites

  • Node.js
  • MySQL

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/your-repo-name.git
    cd your-repo-name
  2. Install dependencies:

    npm install
  3. Create a .env file based on .env.example and update the values as needed:

    cp .env.example .env
  4. Set up your MySQL database and update the .env file with your database credentials.

Running the Application

  • For development:

    npm run dev
  • For production:

    npm start

API Endpoints

  • 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.

Project Configuration

  • nodemon.json: Configuration for Nodemon.
  • tsconfig.json: TypeScript configuration.

About

This is a template for creating a REST API using TypeScript, Express, and MySQL.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published