Skip to content

This is a simple guide and boilerplate on getting started on with Serverless Framework and relational database with Sequelize (ORM for NodeJS). This boilerplate will be use MySQL for database.

Notifications You must be signed in to change notification settings

sinh117801/serverless-sequelize-boilerplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

serverless-sequelize-boilerplate

This is a simple guide and boilerplate on getting started on with Serverless Framework and relational database with Sequelize (ORM for NodeJS). This boilerplate will be use MySQL for database.

Get yourself a serverless REST API up with connected to a MySQL server in a few minutes on NodeJS.

Whats Included

C- Create Book

R- List Books, and Show Book

U- Update Book

D- Delete Book

Guide

First Install and configure Serverless https://github.com/serverless/serverless#quick-start

Then install sequelize v6 and mysql2 for MySQL driver connection. More details about sequelize database connection here

npm install --save sequilize mysql2

MySQL Configuration

Note: This boilerplate assume that database that will be use for this project is already create.

  • Duplicate file .env.example and rename to .env.{stage}. More details about environment variables.
  • Go to .env.{stage} and edit value through each environment variable. These variable will be use in /src/config/database.js
const sequelize = new Sequelize(process.env.DB_NAME, process.env.DB_USERNAME, process.env.DB_PASSWORD, {
  host: process.env.DB_HOST,
  port: process.env.DB_PORT,
  dialect: process.env.DB_DIALECT,
});

Starting serverless offline

npm start

Contributing

All pull requests and feedbacks are welcome and appreciated 😁

Author

Acknowledgments

To all NodeJS and other related field contributors, thank you! 🖤

More information

About

This is a simple guide and boilerplate on getting started on with Serverless Framework and relational database with Sequelize (ORM for NodeJS). This boilerplate will be use MySQL for database.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published