api-mixer/README.md

50 lines
1.2 KiB
Markdown
Raw Normal View History

2018-10-17 15:58:13 +00:00
# | API mixer |
2018-10-17 14:02:29 +00:00
2018-10-17 15:58:13 +00:00
Simple REST API mixer as a service. A minimal service will be deployed on your local port `8000`, all incoming data has to be sent by _POST_ fields (_e.g. [form-data](https://tools.ietf.org/html/rfc2388), [x-www-form-urlencoded](https://www.w3.org/TR/html5/sec-forms.html#urlencoded-form-data)_). The output is a _application/json_ set.
2018-10-22 15:52:29 +00:00
### Project Set up
2018-10-17 15:58:13 +00:00
2018-10-22 15:40:56 +00:00
##### Prerequisites
2018-10-17 15:58:13 +00:00
2018-10-22 15:40:56 +00:00
You need `node` and `npm` installed.
##### 1. Install dependencies
Go into the project's folder and run :
```bash
$ npm i
```
##### 2. Transpile sources
2018-10-17 15:58:13 +00:00
Then launch the following command inside the project's folder :
```bash
2018-10-22 15:40:56 +00:00
$ npm run build
2018-10-17 15:58:13 +00:00
```
All source files of the `src/` folder will be transpiled into the `dist/` folder.
2018-10-22 15:40:56 +00:00
> It is also possible to watch the typescript while developping and modifying files with the command `npm run watch`.
##### 3. Launch server
2018-10-17 15:58:13 +00:00
> You need to have `node` installed.
Launch the server with the following command (inside the project's folder) :
```bash
$ node dist/main.js
2018-10-17 15:58:13 +00:00
```
2018-10-22 15:52:29 +00:00
### Project fast start
2018-10-22 15:44:37 +00:00
2018-10-22 15:52:29 +00:00
This command will build and run the whole project :
```bash
$ npm run build;
$ npm start;
```
### Test the API
2018-10-17 15:58:13 +00:00
2018-10-22 15:52:29 +00:00
You can now use [Postman](https://www.getpostman.com/) or whatever API client at `127.0.0.1:8000`.