A Production Grade RESTful API Boilerplate using Express.js, PostgreSQL and Redis as Caching.
- Express.js
- Sequelize
- Docker Compose
- PostgeSQL
- Babel
- Compression
- Helmet
- UUID
- CRUD Separation
- JWT
- Unified Response
- Redis
- Jest
- Supertest
- Travis CI
- Sentry
- Slack
# Get the latest snapshot
git clone https://github.com/kevink1103/restapi_project.git
# Change directory
cd restapi_project/src
# Make sure to set env variables
cp example.env .env && vi .env
# Run PostgreSQL and Redis using Docker
docker-compose up
# Open a new bash to proceed
# Install sequelize-cli and nodemon globally
npm install -g sequelize-cli
npm install -g nodemon
# Install NPM dependencies
npm install --save-dev
# If this does not work
sudo npm install --save-dev --unsafe-perm=true --allow-root
# Create a database for testing
# Replace <DB_USER> and <DB_TEST> to your own in .env
docker exec -it restapi_postgres psql -U <DB_USER> -c "CREATE DATABASE <DB_TEST>;"
# Try testing - this should be successful!
npm test
# Migrate using Sequelize
sequelize db:migrate
# Then simply start your app
npm start
- Create a user
POST request
Body - x-www-form-urlencoded
KEY:
email
password
127.0.0.1:3000/v1/users/
- Get specific user with UUID
GET request
127.0.0.1:3000/v1/users/UUID_FROM_ABOVE_RESULT/
- Get all users
GET request
127.0.0.1:3000/v1/users/
- Login
POST request
Body - x-www-form-urlencoded
KEY:
email
password
127.0.0.1:3000/v1/auth/login/
- Test token
GET request
Authorization - Bearer Token
Token: TOKEN_RECEIVED_FROM_ABOVE_RESULT
127.0.0.1:3000/v1/auth/tokenTest/
- Delete all users
DELETE request
127.0.0.1:3000/v1/users/
You can start developing your server from here.
Integration with Sequelize, PostgreSQL and Redis is done for you.
- 아하 REST API 서버 개발 (1)
- 아하 REST API 서버 개발 (2)
- 아하 REST API 서버 개발 (3)
- 아하 REST API 서버 개발 (4)
- 아하 REST API 서버 개발 (5)
- 아하 REST API 서버 개발 (6)
- 아하 REST API 서버 개발 (7)
- 아하 REST API 서버 개발 (8)
- 아하 REST API 서버 개발 (9)
- 아하 REST API 서버 개발 (10)
- 아하 REST API 서버 개발 (11)
- 아하 REST API 서버 개발 (12)
- 아하 REST API 서버 개발 (13)
- 아하 REST API 서버 개발 (14)