밑의 json을 postman으로 서버에 보내고 싶은데 고민끝에 찾은 방법을 소개합니다.
raw, json { "loc": { "coordinates": [126.934216, 37.529047] }, }
| # .gitignore file에 node_modules 추가 | |
| git rm -r --cached node_modules | |
| git commit -m 'Remove and ignore directory node_modules' | |
| git push origin master |
참고: http://codekirei.com/posts/currying-with-arrow-functions/
const sum = (a:number) => (b:number) => {
return a+b
}
| if (obj) { | |
| //값이 있을 경우 | |
| } | |
| //응용 | |
| arr = [1, 2, 3] | |
| arr.length ? return (obj.map((number) => <h1>{number}</h1>)) : return (<h1>값이 없음!</h1>) |
| //method는 오브젝트 안에서 f:function() {} 이런식으로 되어있는 것을 말하고, this가 메소드가 속해있는 객체를 가리킨다. | |
| //function은 function f() {} 이런식으로 되어있는 것을말하고 this가 window를 가리킨다. | |
| var a = { | |
| methods: { | |
| methodOfObject: function() { | |
| console.log("callit!") | |
| functionBelongsToWindow() | |
| function functionBelongsToWindow() { | |
| console.log("in functionBelongsToWindow()"+this) // window를 가리키는 this |
| /*1. install GraphicsMagick on Your PC (I installed it on C:) | |
| /*2. install gm pakcage npm i --save gm | |
| /*3. install request npm i --save request | |
| /*4. test this code | |
| /* | |
| /* | |
| */ | |
| const fs = require('fs'), | |
| gm = require('gm').subClass({ | |
| imageMagick: true |
| const express = require('express'); | |
| const bodyParser = require('body-parser'); | |
| const path = require('path'); | |
| const crypto = require('crypto'); | |
| const mongoose = require('mongoose'); | |
| const multer = require('multer'); | |
| const GridFsStorage = require('multer-gridfs-storage'); | |
| const Grid = require('gridfs-stream'); | |
| const app = express(); |
| /* | |
| Let't start | |
| 1. Create a vue project with vue-cli | |
| 2. npm i xlsx | |
| 3. copy below code & paste to App.vue | |
| 4. npm run dev | |
| Here are links that I referenced to make this code. | |
| SheetJS: https://github.com/SheetJS/js-xlsx | |
| Drop & Drag: https://codepen.io/Event_Horizon/pen/WodMjp |
| /* | |
| This one is for post request | |
| { | |
| "name": "test", | |
| "rank": "red belt", | |
| "available": true, | |
| "loc" : {"type": "Point", "coordinates": [-80, 27]} | |
| } | |
| This one is for get request | |
| http://localhost:3030/ninjas?lng=-80&lat=20 |