This repository gives you a simple boilerplate for rapidly developing an application using the PENS stack (nobody calls it that but me).
- Polymer (client-side framework)
- Epilogue & Express (routing frameworks)
- Node (server)
- Sequelize (data access)
This will be links later
- download node, git, npm and bower
- clone this repository
- run
npm install
andbower install
- start hacking!
- run
npm run start
Sequelize and Epilogue team up to make creating routes super easy.
- Create a model in it's own file in
db/models
example:
//db/models/post.js
module.exports = function (sequelize, DataTypes) {
var Post = sequelize.define("Post", {
text: DataTypes.STRING,
title: DataTypes.STRING
}, {
classMethods: {
associate: function (models) {
}
}
});
return Post;
}
- Add your resource to
api/index.js
var posts = rest.resource({
model: db.models.Post,
endpoints: ['/posts', '/posts/:id'],
});
- Test your application
- run
npm run start
- use a rest client (eg. POSTman) and interact with
/api/posts
- you should have basic CRUD routes now.
- run
- consider a resources folder similar to models which is auto included
- create generator for model/resource
- create generator for polymer element
- tests