Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update babel to version 7 #22

Merged
merged 5 commits into from
Sep 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
{
"presets": ["env"],
"presets": [
[
"@babel/preset-env", {
"useBuiltIns": "usage"
}
]
],
"plugins": [
"transform-runtime",
"add-module-exports"
]
"@babel/plugin-transform-runtime"
],
"env": {
"test": {
"plugins": [
"babel-plugin-istanbul"
]

}
}
}
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ language: node_js
sudo: true
dist: trusty
node_js:
- 4
- 6
- 8
- 10
Expand Down
6 changes: 5 additions & 1 deletion examples/.babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{
"presets": ["env"]
"presets": [
["@babel/preset-env", {
"useBuiltIns": "usage"
}]
]
}
32 changes: 19 additions & 13 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,37 @@

## Getting started

### 1.) Install dependencies
```
### 1. Install dependencies
```bash
$ npm i
```

### 2.) Transpile and run application
OR
```bash
$ yarn
```
$ grunt serve

### 2. Transpile and run application
```bash
$ npm start
```

### 3.) Test API
### 3. Test API

Open [Postman](https://www.getpostman.com/)
Open [Postman](https://www.getpostman.com/)

select `POST` method and type `localhost:3338/user`
#### a. `POST /user`

click on body, select `x-www-form-urlencoded`
select `POST` method and type `localhost:3338/user`

type name for `key` and somthing for `value`
click on body, select `x-www-form-urlencoded`

hit send
type name for `key` and something for `value`

you should get
hit `send` button. you should get `create user: something` as respond

`create user: something`
#### b. `GET /user/:id`

as respond
select `GET` method and type (for example) `localhost:3338/user/id`

hit `send` button. you should get response text `user with id: 1`
4 changes: 2 additions & 2 deletions examples/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import express from 'express';
import http from 'http';
import bodyParser from 'body-parser';
import routes from './config/routes';
import mapRoutes from 'express-routes-mapper';
import mapRoutes from '../../lib';

const app = express();
const server = http.Server(app);
Expand All @@ -11,7 +11,7 @@ const port = 3338;
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());

app.use('/', mapRoutes(routes, 'examples/app/controllers/'));
app.use('/', mapRoutes(routes, 'app/controllers/'));

server.listen(port, () => {
console.log('There we go ♕');
Expand Down
2 changes: 1 addition & 1 deletion examples/app/config/routes.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const routes = {
'GET /user:id': 'UserController.get',
'GET /user/:id': 'UserController.get',
'POST /user': 'UserController.create',
};

Expand Down
54 changes: 0 additions & 54 deletions examples/gulpfile.babel.js

This file was deleted.

16 changes: 6 additions & 10 deletions examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,17 @@
"description": "",
"main": "app/app.js",
"scripts": {
"start": "nodemon --exec babel-node app/app.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Lukas Aichbauer <[email protected]> (https://github.com/rudolfsonjunior/)",
"license": "MIT",
"devDependencies": {
"babel-polyfill": "^6.23.0",
"babel-preset-env": "^1.1.11",
"del": "^2.2.2",
"gulp": "^3.9.1",
"gulp-babel": "^6.1.2",
"gulp-load-plugins": "^1.5.0",
"gulp-newer": "^1.3.0",
"gulp-nodemon": "^2.2.1",
"gulp-sourcemaps": "^2.4.1",
"run-sequence": "^1.2.2"
"@babel/core": "^7.0.0",
"@babel/node": "^7.0.0",
"@babel/polyfill": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"nodemon": "^1.18.4"
},
"dependencies": {
"body-parser": "^1.17.1",
Expand Down
Loading