0.5.3 • Published 7 years ago

frnt v0.5.3

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

frnt

Front-end server for your website, in nodejs.

Install

npm install frnt

Super simple to setup:

const frnt = require('frnt');
const fs = require("fs");
const path = require("path");
const express = require('express');
const app = express();
const doT = require('express-dot');

const port = process.env.PORT || 8080;

// The link to your wordpress site
const contentUrl = process.env.CONTENT_URL || 'http://localhost:8081';

// Define where the public files are, in this example ./public
app.use(express.static(path.join(__dirname, 'public')));

// Setup the frnt middleware with the link to the internal server
app.use(frnt.init({
    proxyUrl: contentUrl,
    logLevel: 'verbose'
}));

// define rendering engine
app.set('views', path.join(__dirname, "views"));
app.set('view engine', 'html' );
app.engine('html', doT.__express );

app.listen(port, err => {
    if (err) {
        console.log('Error, could not start:', err);
        process.exit(1);
    }
    console.log('\nStarted server on http://localhost:%s\n', port);
}); 

Example

To run the example, go into the example/ folder and

npm i
CONTENT_URL=http://your-json-based-content-url PORT=8080 node index.js
0.5.3

7 years ago

0.5.2

7 years ago

0.5.1

7 years ago

0.5.0

7 years ago

0.4.3

7 years ago

0.4.2

10 years ago

0.4.1

10 years ago

0.4.0

10 years ago

0.3.9

10 years ago

0.3.8

10 years ago

0.3.7

10 years ago

0.3.6

10 years ago

0.3.5

10 years ago

0.3.0

10 years ago

0.0.3

10 years ago

0.0.1

10 years ago