Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/spinningideas/sequelize-poc
Reference implementation of node api using Sequelize ORM and PostgreSQL DB
https://github.com/spinningideas/sequelize-poc
database expressjs javascript orm-poc postgresql sequelize sequelize-orm
Last synced: about 1 month ago
JSON representation
Reference implementation of node api using Sequelize ORM and PostgreSQL DB
- Host: GitHub
- URL: https://github.com/spinningideas/sequelize-poc
- Owner: spinningideas
- License: mit
- Created: 2019-12-24T19:04:50.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-20T02:44:27.000Z (about 2 years ago)
- Last Synced: 2024-11-14T03:35:08.684Z (3 months ago)
- Topics: database, expressjs, javascript, orm-poc, postgresql, sequelize, sequelize-orm
- Language: JavaScript
- Homepage:
- Size: 4.68 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: ReadMe.md
- License: LICENSE
Awesome Lists containing this project
README
# Sequelize ORM POC
The code in this repo demonstrates use of [sequelize](https://sequelize.org/v6/) as an ORM using two tables with geography data sets (continents and countries).
This code uses the following libaries:
- [sequelize](https://sequelize.org/v6/)
- [express](https://expressjs.com/)
- [postgresql](https://www.postgresql.org/) - NOTE: could use any db sequelize supports
- [sequelize-cli](https://github.com/sequelize/cli) - database migrations and seedingThis proof of concept uses a repository to get data from database and via [express](https://expressjs.com/).
## Get Started
You will need to change directory into the "server" folder to install and run the application
To get started perform the following steps:
### 1) Install PostGre SQL
https://www.postgresql.org/download/
### 2) Create PostGre SQL database to use in this POC
After installing locally you should have database server and you need to enable credentials from Database.ts with access empty database named "sequelize_orm_poc"
### 3) Install npm packages
You will need to change directory into the server folder to install and run the application
Install the required packages after changing directory into the "server" folder
```npm install```
### 4) Create database schema using sequelize migrations
run the following command - see more: https://sequelize.org/master/manual/migrations.html
```npx sequelize-cli db:migrate```
### 5) Populate database with data using sequelize data seeding
```npx sequelize db:seed:all --debug```
### 6) run the application
The application is configured to use nodemon to monitor for file changes and you can run command to start the application using it. You will see console information with url and port.
```npm run start```
### 7) exercise the application via postman OR thunder client
#### 7.1 - Get a client
1) https://www.thunderclient.com/
2) https://www.getpostman.com - Download and install https://www.getpostman.com
#### 7.2 - Import "postman" collection and run requests
Use the client of your choice to run the requests to see api data and responses after importing the collection in the "postman" folder