Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thinkjs/think-router
Router for ThinkJS 3.x
https://github.com/thinkjs/think-router
router think-middleware thinkjs thinkjs3
Last synced: 4 days ago
JSON representation
Router for ThinkJS 3.x
- Host: GitHub
- URL: https://github.com/thinkjs/think-router
- Owner: thinkjs
- License: mit
- Created: 2017-03-11T01:00:34.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-07-01T00:08:33.000Z (over 3 years ago)
- Last Synced: 2024-10-24T06:31:38.108Z (16 days ago)
- Topics: router, think-middleware, thinkjs, thinkjs3
- Language: JavaScript
- Size: 50.8 KB
- Stars: 7
- Watchers: 10
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- think-awesome - think-router - router.svg) | ![](https://travis-ci.org/thinkjs/think-router.svg) | ![](https://coveralls.io/repos/github/thinkjs/think-router/badge.svg) | Router Parser | (Middlewares)
README
# think-router
[![Build Status](https://travis-ci.org/thinkjs/think-router.svg?branch=master)](https://travis-ci.org/thinkjs/think-router)
[![Coverage Status](https://coveralls.io/repos/github/thinkjs/think-router/badge.svg)](https://coveralls.io/github/thinkjs/think-router)
[![npm](https://img.shields.io/npm/v/think-router.svg)](https://www.npmjs.com/package/think-router)Router for ThinkJS 3.x
## Install
```
npm install think-router
```## How to use
config file `src/config/middleware.js`
```js
const router = require('think-router');
module.exports = [
{handle: router, options: {}}
];
```support options:
```js
{
defaultModule: 'home', //default module name, is enable in multi module mode
defaultController: 'index', //default controller name
defaultAction: 'index', //default action name
prefix: [], // url prefix
suffix: ['.html'], // url suffix
enableDefaultRouter: true,
optimizeHomepageRouter: true,
subdomainOffset: 2,
subdomain: {}, //subdomain
denyModules: [] //deny module, enable in multi module mode
}
```## Router config
config file `src/config/router.js`
```js
module.exports = [
['/index', '/list']
]
```