-
-
Notifications
You must be signed in to change notification settings - Fork 586
How To Add Silex To Your Node.js Project
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
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.
$ npm install -S silex-website-builder
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');
});
$ 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",
...
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.
WARNING: Support for Silex v2 has stopped. Try Silex v3 alpha, Read about it, Subscribe to the newsletter