How To Add Silex To Your Node.js Project
Pages 48
Clone this wiki locally
This document is a work in progress, we need your help, ask questions in the issues and add answers here please
Adding Silex to your nodejs project is useful if you plan to customize Silex. Here are the pages related to this one:
Here is the code which is explained in this page
Requirements
Check the node version supported by Silex, it is in the file .nvmrc
here. It should support more recent nodejs version but it is not guaranteed.
If your project is a nodejs project you probably already have a package.json
, if not use npm init
to create one.
Install Silex as an npm dependency
$ npm install -S silex-website-builder
Create a start script
Create a file and name it index.js
const { SilexServer, Config } = require('silex-website-builder');
const config = new Config();
const silex = new SilexServer(config);
silex.start(function() {
console.log('server started');
});
Start Silex
$ node index.js
Test Silex at the address http://localhost:6805/
.
Also you may want to add this to your package.json
so that it starts when you do npm start
:
...
"start": "node index.js",
...
Next steps
Now you can
This is the documentation for Silex website builder. It is a collaborative effort, click edit and start contributing. Also have a look at these discussions.