Skip to content

Latest commit

 

History

History

example

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

TypeScript ORM Example with Express.js

This is a sample Express.js application demonstrating the usage of the TypeScript ORM library with SQLite.

Installation

cd example
npm install

Running the Application

npm start

Or for development with auto-reload:

npm run dev

The server will start on http://localhost:3000

API Endpoints

  • GET / - API documentation
  • GET /health - Database health check
  • GET /users - Get all users
  • GET /users/:id - Get user by ID
  • POST /users - Create a new user
  • PUT /users/:id - Update a user
  • DELETE /users/:id - Delete a user

Example API Calls

Create a user

curl -X POST http://localhost:3000/users \
  -H "Content-Type: application/json" \
  -d '{"name":"John Doe","email":"[email protected]","age":30}'

Get all users

curl http://localhost:3000/users

Get user by ID

curl http://localhost:3000/users/1

Update a user

curl -X PUT http://localhost:3000/users/1 \
  -H "Content-Type: application/json" \
  -d '{"name":"John Updated","email":"[email protected]","age":31}'

Delete a user

curl -X DELETE http://localhost:3000/users/1

Database

The application uses SQLite and creates a file example.db in the example directory.