项目作者: eseom

项目描述 :
simple backend webstack with hapi, sequelize, kuejs
高级语言: TypeScript
项目地址: git://github.com/eseom/hails.git
创建时间: 2017-04-23T05:54:01Z
项目社区:https://github.com/eseom/hails

开源协议:

下载


hails

hapi based web stack with sequelize, kuejs, etc.

  • from 0.4.0, added supports for hapi17

npm version

get started

  1. mkdir my-project
  2. cd $_
  3. yarn add hails
  4. mkdir -p src/core
  5. # settings.js
  6. echo "module.exports = {
  7. development: {
  8. context: './src',
  9. modules: [
  10. 'core',
  11. ],
  12. },
  13. }" > settings.js
  14. # src/core/api.js
  15. echo "export default () => [{
  16. method: 'GET',
  17. path: '/',
  18. handler(request) {
  19. return 'hello world'
  20. },
  21. }]" > src/core/api.js
  22. # that's all, run a server.
  23. yarn hails run
  24. # open http://localhost:3000

sample code

  1. git clone https://github.com/eseom/hails-sample <project name>
  2. cd <project name>
  3. yarn
  4. yarn dev

feature

  • essential hapi plugins
  • module system like django
  • sequelize integrated
  • kue integrated

default options

  1. export default {
  2. context: undefined,
  3. vesion: undefined,
  4. server: {
  5. host: 'localhost',
  6. port: 3000,
  7. },
  8. logger: {
  9. level: 'silly',
  10. },
  11. modules: [],
  12. useSequelize: false,
  13. viewEngine: {
  14. type: 'nunjucks',
  15. },
  16. scheduler: {
  17. enable: false,
  18. },
  19. swagger: {
  20. info: {
  21. title: 'API Documentation',
  22. },
  23. grouping: 'tags',
  24. },
  25. yar: {
  26. engine: {
  27. type: 'memory',
  28. },
  29. cookieOptions: {
  30. password: 'the-password-must-be-at-least-32-characters-long',
  31. isSecure: false,
  32. },
  33. },
  34. }

development

  1. yarn
  2. yarn watch

api

  • (TODO)