# @codforc/backfront

> Easy configurable backend server

Latest version **1.0.0** (published 2023-06-13) · ISC license · 0 weekly downloads

## Install

```sh
npm install @codforc/backfront
pnpm add @codforc/backfront
yarn add @codforc/backfront
bun add @codforc/backfront
```

Provides the command `backfront`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2023-06-13 |
| First published | 2023-06-13 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 9.9 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | codforc |
| Maintainers | codforc |

## Links

- npm: https://www.npmjs.com/package/@codforc/backfront
- Repository: https://github.com/codforc/backfront
- Homepage: https://github.com/codforc/backfront#readme
- Issues: https://github.com/codforc/backfront/issues
- npm.io page: https://npm.io/package/@codforc/backfront

## Dependencies (7)

- [ejs](https://npm.io/package/ejs.md) ^3.1.9
- [pug](https://npm.io/package/pug.md) ^3.0.2
- [yaml](https://npm.io/package/yaml.md) ^2.3.1
- [ngrok](https://npm.io/package/ngrok.md) ^5.0.0-beta.2
- [chokidar](https://npm.io/package/chokidar.md) ^3.5.3
- [nunjucks](https://npm.io/package/nunjucks.md) ^3.2.4
- [localtunnel](https://npm.io/package/localtunnel.md) ^2.0.2

## Recent versions

- 1.0.0 (latest) — 2023-06-13

## README

# Backfront

Backfront is easy configurable backend server for frontend developers.

## Installation
```
  npm i -g @codforc/backfront
```





## Features

- Template routing & Context data support
- Static serving
- JSON, Direct HTTP Response
- Template engine
    - Ejs
    - Pug
    - Nunjucks (Jinja2 equivalent)
- Expose via localtunnel, ngrok



## Quickstart

Create yaml config file in your project root. If you don't want to use template engine, just remove `template_engine` key in config.

### Quickstart configuration sample

```yaml
routes:
  /: 'index.pug'
  /login: 'login.pug'
  /profile: ['/profile', {'name': 'deniz'}]

  return:
    /json_profile: {'name': 'john doe', 'profile_img': 'src_to_image'}
    /login_success: [200, {'msg': 'ok', 'redirect_uri': '/'}]
    /login_error: [401, {'msg': 'wrong_credentials'}]
    /return_200: 200

template_engine: pug
```

Then,  ```backfront <config-file>.yml```, done!
## Configuration Options

`workdir`: Working directory, default path is current directory.

`templates`: Templates folder, default `/templates/`

`static`: Static folder, default `/static/`

`template_engine`: Template engine, accepts `ejs`, `pug` or `nunjucks`

`host`: Server host, `port`: Server port

`expose`: expose provider, `ngrok` or  `localtunnel`
 - If you select expose provider as ngrok.
 - ```
    expose: ngrok
    ngrok:
      authtoken: <your-authtoken>
      region: en, #default us
   ```

---
_Source: https://npm.io/package/@codforc/backfront · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
