An open API service indexing awesome lists of open source software.

https://github.com/reactend/reactend-express

React renderer to build Node.js server
https://github.com/reactend/reactend-express

nodejs nodejs-server react

Last synced: 3 months ago
JSON representation

React renderer to build Node.js server

Awesome Lists containing this project

README

          

# Reactend / Express

React-like http-server on Nodejs

### 🕹 [Playground on repl.it](https://repl.it/@orkhanjafarov/reactend-playground?v=1)

### 📄 [Reactend Template](https://github.com/gigantz/reactend-template)


![Planet Express](./logo.svg)

## What's that?

- Node.js http-server based on React-Components
- Express.js inside
- Get, Post, Delete and etc. components to use router method
- `Get(render)` and `Res.Render` to render your regular React DOM Components
- useContext(ReqResContext) hook to access `req, res`
- Support `styled-components`
- Built-in logger (morgan)
- Middleware component in Router and its Routes
- `handler` prop in Route components to use as regular controller

_and many many features that should be documented..._


## Get started

Run this to create reactend project on your local machine

```
npx create-reactend my-app
```


You choose template (default: basic)

```
npx create-reactend my-app --template faker
```


## Code Example

```js
import React from 'react';
import { resolve } from 'path';

import { registerApp, App, Static, Router, Get, Post, Res, Logger } from '@reactend/express';

const ExpressApp = () => (










console.log(req.originalUrl)}
/>




);

registerApp(ExpressApp);
```


## You can use this way too

```js
import cors from 'cors';
;
```

```js


Shut Up And Take My Money!

} />

```


## Components

_This minor description for now (Docs is on the way)_


`` - App Instance (props: port)

`` - Static route (props: publicPath, path, options)

`` - Router-Provider (props: path)

`, and ...` - Route component (props: path, content,
handler, status)

`` - Middleware (props: handler)

`` - morgan logger (props: mode, disabled)

`` - Response components

`` - Render (props: component)

`` - Response send (props: json, text, contentType)

`` - Response Status (props: statusCode)

`` - Response Send File (props: path, options,
onError)

`` - Redirect (props: path, statusCode)

`` - Redirect (props: length, locale, map)




---

## Contact me

Email me if you have any idea and you would like to be contributor [orkhanjafarovr@gmail.com](mailto:orkhanjafarovr@gmail.com)

Cheers ✨