Express api example using TypeORM with JavaScript
- Clone repository
- 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
}
- I'm using PostgreSQL, if you want to use another DB just change it and replace package.
- Run
npm i
- Run
node app.js
to run simple example
- Point your browser to http://localhost:3000 to test
- http://localhost:3000/filldb to insert data into DB
- http://localhost:3000/api/categories to list categories