Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/masfranzhuo/sequalize-express-sqlite
Node.js CRUD application based on the SQLite database design and Express.js framework
https://github.com/masfranzhuo/sequalize-express-sqlite
express express-js expressjs node node-js nodejs nodejs-framework sequalize sequalizejs sqlite sqlite-database sqlite3 sqlite3-database
Last synced: about 2 months ago
JSON representation
Node.js CRUD application based on the SQLite database design and Express.js framework
- Host: GitHub
- URL: https://github.com/masfranzhuo/sequalize-express-sqlite
- Owner: masfranzhuo
- Created: 2018-02-12T13:50:41.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-03-14T07:59:54.000Z (almost 7 years ago)
- Last Synced: 2023-10-20T21:39:48.272Z (about 1 year ago)
- Topics: express, express-js, expressjs, node, node-js, nodejs, nodejs-framework, sequalize, sequalizejs, sqlite, sqlite-database, sqlite3, sqlite3-database
- Language: JavaScript
- Homepage: http://sequalize-express-sqlite.herokuapp.com/
- Size: 9.77 KB
- Stars: 25
- Watchers: 2
- Forks: 23
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/masfranzhuo/sequalize-express-SQLite.svg?branch=master)](https://travis-ci.org/masfranzhuo/sequalize-express-SQLite)
# Node.js sequelize express CRUD
Node.js CRUD application based on the SQLite database design and Express.js frameworkThis Node.js CRUD code use
- Express.js framework
- SQLite database
- sequelize ORM
- dotenv module for setting environment
```
npm initnpm install --save express sqlite3 sequelize body-parser
npm install --save dotenv
```## Database
The application connect to SQLite database using sequalize. The configuration of database added in `models/index.js`. Create folder `data` on the root project for SQLite storage path.
```
var sequelize = new Sequelize('example', 'root', '', {
host: 'localhost',
dialect: 'sqlite',
operatorsAliases: false,
// SQLite database path
storage: './data/database.sqlite'
});
```Initialize the configuration and connect to database on `app.js`.
```
var models = require("./models");models.sequelize.sync().then(function() {
console.log('connected to database')
}).catch(function(err) {
console.log(err)
});
```This app use database named `example` and `books` table which has 4 columns.
## Route
Create `routes` folder on the root path and put route file there. After that initialiaze and register route file path on `app.js` file.```
var books = require('./routes/books');app.use('/books', books);
```## Documentation
This API documented with [Swagger](https://app.swaggerhub.com/apis/masfranzhuo/sequalize-express-SQLite/1.0.0) and hosted on [Heroku](http://sequalize-express-sqlite.herokuapp.com/)