1.2.1 • Published 10 months ago

@boutdecode/yion v1.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Yion bundle by Bout de code

https://boutdecode.fr

Bout de code - Développement de site internet et blog avec de vrais morceaux de codes, simples, élégants, utiles (parfois) et surtout sans fioriture.

Installation

$ npm install @boutdecode/yion

Yion plugin

For yion :

const { 
  createApp,
  createServer,
  bodyParser,
  logger,
  session,
  encoding,
  i18n,
  assets
} = require('@boutdecode/yion')

const app = createApp()
const server = createServer(app)

app.use(logger())
app.use(bodyParser())
app.use(session())
app.use(encoding())
app.use(i18n())
app.use(assets())

app.get('/', ({ res }) => {
  res
    .set('Content-Type', 'text/html; charset=utf-8')
    .set('Content-Encoding', 'gzip')
    .send(`
      <!DOCTYPE html>
      <html>
        <head>
          <title>Yion</title>
          <meta charset="utf-8">
        </head>
        <body>
          <h1>Hello world</h1>
        </body>
      </html>
    `)
})

server.listen(8080)

OR you can bootstrap application in one line

const { bootstrap } = require('@boutdecode/yion')

bootstrap({
  api: true,
  view: 'jsx',
  store: true,
  config: {
    application: {
      port: 8080
    }
  }
})

Tests

$ npm run test