Skip to content

Latest commit

 

History

History
23 lines (22 loc) · 749 Bytes

File metadata and controls

23 lines (22 loc) · 749 Bytes

Express api example using TypeORM with JavaScript

  1. Clone repository
  2. Rename ormconfig.template.json to ormconfig.json and fill with your PostgreSQL database info. Something like:
{
    "type": "postgres",
    "host": "localhost",
    "port": 5432,
    "username": "postgres",
    "password": "postgres",
    "database": "test",
    "entities": ["src/entity/*.js"],
    "logging": true,
    "synchronize": true
}
  1. I'm using PostgreSQL, if you want to use another DB just change it and replace package.
  2. Run npm i
  3. Run node app.js to run simple example
  4. Point your browser to http://localhost:3000 to test
  5. http://localhost:3000/filldb to insert data into DB
  6. http://localhost:3000/api/categories to list categories