Skip to content

This is a simple API server built with TypeScript and Express

Notifications You must be signed in to change notification settings

phinahasWazeefa/typescript-api-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sample API Server with TypeScript and Express

This is a simple API server built with TypeScript and Express, handling only one API endpoint. It also includes a build script to copy configuration files and clean the build directory before compiling.

🚀 How to Run the API Server

1️⃣ Install Dependencies

npm install

2️⃣ Start the Server (Development Mode)

npm run serve

3️⃣ Build for Production

npm run build

4️⃣ Start the Server (Production Mode)

npm start

🛠 Build Process & build.js

The build.js script performs the following steps:

  1. Deletes the dist/ folder (to ensure a clean build).
  2. Compiles TypeScript files into JavaScript.
  3. Copies the web.config file to dist/ (for IIS deployment).

📜 Package Scripts

"scripts": {
  "dev": "nodemon src/server.ts",
  "build": "node build.js",
  "start": "node dist/server.js"
}

🏁 Summary

  • rimraf is used to clean the dist/ folder before rebuilding.
  • build.js ensures the web.config is copied after compilation.
  • The server runs in dist/ after building.

This setup ensures smooth development and deployment to IIS or any Node.js server. 🚀

About

This is a simple API server built with TypeScript and Express

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published