나는 빡빡이.
');
7 | });
8 | server.listen(8080);
9 |
10 | server.on('listening', () => {
11 | console.log('8080번 포트에서 대기 중 입니다.');
12 | });
13 |
14 | server.on('error', (error) => {
15 | console.error(error)
16 | })
--------------------------------------------------------------------------------
/JS/NodeJS/02_node_httpServer/server1.js:
--------------------------------------------------------------------------------
1 | const http = require('http');
2 |
3 | http.createServer((req, res) => {
4 | res.write('
'); // [응답] 클라이언트로 html을 보내고 응답을 종료. -> 이후의 응답은 작동 안함.
6 | res.write('
나는 빡빡이.
') // 응답안함.
7 | }).listen(8080, () => {
8 | console.log('8080번 포트에서 서버 대기 중입니다!');
9 | });
--------------------------------------------------------------------------------
/JS/NodeJS/02_node_httpServer/server2.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
Node.js 웹 서버
8 |
9 |
10 |
Node.js 웹 서버
11 |
만들 준비되셨나요?
12 |
13 |
--------------------------------------------------------------------------------
/JS/NodeJS/02_node_httpServer/server2.js:
--------------------------------------------------------------------------------
1 | const http = require('http');
2 | const fs = require('fs');
3 |
4 | http.createServer((req, res) => {
5 | fs.readFile('./server2.html', (err, data) => {
6 | if (err) {
7 | throw err;
8 | }
9 | res.end(data);
10 | });
11 | }).listen(8081, () => {
12 | console.log('8081번 포트에서 서버 대기 중 입니다.');
13 | })
--------------------------------------------------------------------------------
/JS/NodeJS/02_node_httpServer/server3.js:
--------------------------------------------------------------------------------
1 | const http = require('http');
2 |
3 | const parseCookies = ( cookie = '' ) =>
4 | // parseCookies('name=junu;age=18')
5 | cookie
6 | .split(';') // [name=junu, age=18]
7 | .map((v) => v.split('=')) // [[name, junu], [age, 18]]
8 | .map(([k, ...vs]) => [k, vs.join('=')]) // 배열에 '='이 있을경우 제외
9 | .reduce((acc, [k, v]) => { // reduce(() => {}, {}) 인 경우에. 배열을 객체로 변화시킨다.
10 | acc[k.trim()] = decodeURIComponent(v);
11 | return acc;
12 | }, {});
13 |
14 | http.createServer((req, res) => {
15 | const cookies = parseCookies(req.headers.cookie);
16 | console.log(req.url, cookies);
17 | res.writeHead(200, { 'Set-Cookie': 'mycookie=test' });
18 | res.end('Hello Cookie');
19 | }).listen(8082, () => {
20 | console.log('8082번 포트에서 서버 대기 중 입니다.');
21 | })
--------------------------------------------------------------------------------
/JS/NodeJS/02_node_httpServer/server4.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
쿠키&세션 이해하기
8 |
9 |
10 |
14 |
15 |
--------------------------------------------------------------------------------
/JS/NodeJS/02_node_httpServer/server4.js:
--------------------------------------------------------------------------------
1 | const http = require('http');
2 | const fs = require('fs');
3 | const url = require('url');
4 | const qs = require('querystring');
5 |
6 | const parseCookies = ( cookie = '' ) =>
7 | cookie
8 | .split(';')
9 | .map((v) => v.split('='))
10 | .map(([k, ...vs]) => [k, vs.join('=')])
11 | .reduce((acc, [k, v]) => {
12 | acc[k.trim()] = decodeURIComponent(v);
13 | return acc;
14 | }, {});
15 |
16 | http.createServer((req, res) => {
17 | const cookies = parseCookies(req.headers.cookie);
18 | if (req.url.startsWith('/login')) {
19 | const { query } = url.parse(req.url);
20 | const { name } = qs.parse(query);
21 | const expires = new Date();
22 | expires.setMinutes(expires.getMinutes() + 1);
23 |
24 | res.writeHead(302, {
25 | Location: '/',
26 | 'Set-Cookie': `name=${encodeURIComponent(name)}; Expires=${expires.toGMTString()}; HttpOnly; Path=/`
27 | });
28 | res.end();
29 | } else if (cookies.name) {
30 | res.writeHead(200, { 'Content-Type' : 'text/html; charset=utf-8'});
31 | res.end(`${cookies.name}님 안녕하세요.`);
32 | } else {
33 | fs.readFile('./server4.html', (err, data) => {
34 | if (err) {
35 | throw err;
36 | }
37 | res.end(data);
38 | });
39 | }
40 | }).listen(8083, () => {
41 | console.log('8083번 포트에서 서버 대기 중 입니다!');
42 | });
--------------------------------------------------------------------------------
/JS/NodeJS/02_node_httpServer/server5.js:
--------------------------------------------------------------------------------
1 | const fs = require('fs');
2 | const qs = require('querystring');
3 | const url = require('url');
4 | const http = require('http');
5 |
6 | const parseCookies = ( cookie = '' ) =>
7 | cookie
8 | .split(';')
9 | .map((v) => v.split('='))
10 | .map(([k, ...vs]) => [k, vs.join('=')])
11 | .reduce((acc, [k, v]) => {
12 | acc[k.trim()] = decodeURIComponent(v);
13 | return acc;
14 | }, {});
15 |
16 | const session = {}
17 |
18 | http.createServer((req, res) => {
19 | const cookie = parseCookies(req.headers.cookie);
20 | if (req.url.startsWith('/login')) {
21 | const { query } = url.parse(req.url);
22 | const { name } = qs.parse(query);
23 | const expires = new Date;
24 | expires.setMinutes(expires.getMinutes() + 1);
25 | const randomInt = +new Date();
26 | session[randomInt] = {
27 | name,
28 | expires,
29 | };
30 | res.writeHead(302, {
31 | Location: '/',
32 | 'Set-Cookie': `session=${randomInt}; Expires=${expires.toGMTString()}; HttpOnly; path=/`,
33 | });
34 | res.end();
35 | } else if (cookie.session && session[cookie.session].expires > new Date()) {
36 | res.writeHead(200, { 'Content-Type' : 'text/html; charset=utf-8' });
37 | res.end(`${session[cookie.session].name}님 안녕하세요`);
38 | } else {
39 | fs.readFile('./server4.html', (err, data) => {
40 | if (err) {
41 | throw err;
42 | }
43 |
44 | res.end(data);
45 | })
46 | }
47 | }).listen(8084, () => {
48 | console.log('8084번 포트에서 서버 대기 중입니다!');
49 | });
--------------------------------------------------------------------------------
/JS/NodeJS/03_node_restful/about.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
RESTful SERVER
8 |
9 |
10 |
11 |
15 |
16 |
소개 페이지입니다.
17 |
사용자 이름을 등록하세요!
18 |
19 |
20 |
--------------------------------------------------------------------------------
/JS/NodeJS/03_node_restful/cluster.js:
--------------------------------------------------------------------------------
1 | const cluster = require('cluster');
2 | const numCPUs = require('os').cpus().length;
3 | const http = require('http');
4 |
5 | if (cluster.isMaster) {
6 | console.log(`마스터 프로세스 아이디 : ${process.pid}`);
7 | // cpu개수 만큼 워커를 생산 - 4개
8 | for (let i = 0; i < numCPUs; i++) {
9 | cluster.fork();
10 | }
11 | // 워커가 종료되었을 때
12 | cluster.on('exit', (worker, code, signal) => {
13 | console.log(`${worker.process.pid}번 워커가 종료되었습니다.`);
14 | cluster.fork();
15 | });
16 | } else {
17 | // 워커들이 포트에서 대기
18 | http.createServer((req, res) => {
19 | res.write('
Hello Node!
');
20 | res.end('
Hello Cluster!
');
21 | setTimeout(() => {
22 | process.exit(1);
23 | }, 1000);
24 | }).listen(8085);
25 |
26 | console.log(`${process.pid}번 워커 실행`);
27 | }
--------------------------------------------------------------------------------
/JS/NodeJS/03_node_restful/http2.js:
--------------------------------------------------------------------------------
1 | const http2 = require('http2');
2 | const fs = require('fs');
3 |
4 | http2.createSecureServer({
5 | cert: fs.readFileSync('도메인 인증서 경로'),
6 | key: fs.readFileSync('도메인 비밀키 경로'),
7 | ca: [
8 | fs.readFileSync('상위 인증서 경로'),
9 | fs.readFileSync('상위 인증서 경로')
10 | ],
11 | }, (req, res) => {
12 | res.write('
Hello Node!
');
13 | res.end('
Hello Server!
');
14 | }).listen(443, () => {
15 | console.log('443번 포트에서 서버 대기 중 입니다!');
16 | });
--------------------------------------------------------------------------------
/JS/NodeJS/03_node_restful/https1-1.js:
--------------------------------------------------------------------------------
1 | const https = require('https');
2 | const fs = require('fs');
3 |
4 | https.createServer({
5 | cert: fs.readFileSync('도메인 인증서 경로'),
6 | key: fs.readFileSync('도메인 비밀키 경로'),
7 | ca: [
8 | fs.readFileSync('상위 인증서 경로'),
9 | fs.readFileSync('상위 인증서 경로')
10 | ],
11 | }, (req, res) => {
12 | res.write('
Hello Node!
');
13 | res.end('
Hello Server!
');
14 | }).listen(443, () => {
15 | console.log('443번 포트에서 서버 대기 중 입니다!');
16 | });
--------------------------------------------------------------------------------
/JS/NodeJS/03_node_restful/https1.js:
--------------------------------------------------------------------------------
1 | const http = require('http');
2 |
3 | http.createServer((req, res) => {
4 | res.write('
Hello Node!
');
5 | res.end('
Hello Server!
');
6 | }).listen(8080, () => {
7 | console.log('8080번 포트에서 서버 대기 중 입니다!');
8 | });
--------------------------------------------------------------------------------
/JS/NodeJS/03_node_restful/restFront.css:
--------------------------------------------------------------------------------
1 | a {
2 | color: blue;
3 | text-decoration: none;
4 | }
--------------------------------------------------------------------------------
/JS/NodeJS/03_node_restful/restFront.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
RESTful SERVER
8 |
9 |
10 |
11 |
15 |
16 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/JS/NodeJS/04_npm/index.js:
--------------------------------------------------------------------------------
1 | module.exports = () => {
2 | return 'hello package';
3 | };
4 |
5 | // 터미널에서 npm publish 를 통해서 배포가능.
6 | // 터미널에서 npm unpublish [페키지이름] 을 통해서 배포가능. - 단 24시간 안에 삭제해야함.
--------------------------------------------------------------------------------
/JS/NodeJS/04_npm/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "npm_practice_junukim",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC"
12 | }
13 |
--------------------------------------------------------------------------------
/JS/NodeJS/05_node_express/learn-express/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
--------------------------------------------------------------------------------
/JS/NodeJS/05_node_express/learn-express/bin/www:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 | var app = require('../app');
3 | var debug = require('debug')('learn-express:server'); // 콘솔에 로그를 남겨줌.
4 | var http = require('http');
5 |
6 | var port = normalizePort(process.env.PORT || '3000');
7 | app.set('port', port);
8 |
9 | var server = http.createServer(app);
10 |
11 | server.listen(port);
12 | server.on('error', onError);
13 | server.on('listening', onListening);
14 |
15 | function normalizePort(val) {
16 | var port = parseInt(val, 10);
17 |
18 | if (isNaN(port)) {
19 | return val;
20 | }
21 |
22 | if (port >= 0) {
23 | return port;
24 | }
25 |
26 | return false;
27 | }
28 |
29 | function onError(error) {
30 | if (error.syscall !== 'listen') {
31 | throw error;
32 | }
33 |
34 | var bind = typeof port === 'string'
35 | ? 'Pipe ' + port
36 | : 'Port ' + port;
37 |
38 | switch (error.code) {
39 | case 'EACCES':
40 | console.error(bind + ' requires elevated privileges');
41 | process.exit(1);
42 | break;
43 | case 'EADDRINUSE':
44 | console.error(bind + ' is already in use');
45 | process.exit(1);
46 | break;
47 | default:
48 | throw error;
49 | }
50 | }
51 |
52 | function onListening() {
53 | var addr = server.address();
54 | var bind = typeof addr === 'string'
55 | ? 'pipe ' + addr
56 | : 'port ' + addr.port;
57 | debug('Listening on ' + bind);
58 | }
59 |
--------------------------------------------------------------------------------
/JS/NodeJS/05_node_express/learn-express/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "learn-express",
3 | "version": "0.0.0",
4 | "private": true,
5 | "scripts": {
6 | "start": "node ./bin/www"
7 | },
8 | "dependencies": {
9 | "connect-flash": "^0.1.1",
10 | "cookie-parser": "~1.4.3",
11 | "debug": "~2.6.9",
12 | "express": "~4.16.0",
13 | "express-session": "^1.15.6",
14 | "http-errors": "~1.6.2",
15 | "morgan": "~1.9.0",
16 | "pug": "2.0.0-beta11"
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/JS/NodeJS/05_node_express/learn-express/public/stylesheets/style.css:
--------------------------------------------------------------------------------
1 | body {
2 | padding: 50px;
3 | font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
4 | }
5 |
6 | a {
7 | color: #00B7FF;
8 | }
9 |
--------------------------------------------------------------------------------
/JS/NodeJS/05_node_express/learn-express/routes/index.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var router = express.Router();
3 |
4 | /* GET home page. */
5 | router.get('/', function(req, res, next) {
6 | res.render('index', { title: 'Express' });
7 | });
8 |
9 | module.exports = router;
10 |
--------------------------------------------------------------------------------
/JS/NodeJS/05_node_express/learn-express/routes/users.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var router = express.Router();
3 |
4 | /* GET users listing. */
5 | router.get('/', function(req, res, next) {
6 | res.send('respond with a resource');
7 | });
8 |
9 | router.get('/flash', (req, res) => {
10 | req.session.message = '세션 메시지';
11 | req.flash('message', 'flash 메시지');
12 | res.redirect('/users/flash/result');
13 | });
14 |
15 | router.get('/flash/result', (req, res) => {
16 | res.send(`${req.session.message} & ${req.flash('message')}`);
17 | });
18 |
19 | module.exports = router;
20 |
--------------------------------------------------------------------------------
/JS/NodeJS/05_node_express/learn-express/views/error.pug:
--------------------------------------------------------------------------------
1 | extends layout
2 |
3 | block content
4 | h1= message
5 | h2= error.status
6 | pre #{error.stack}
7 |
--------------------------------------------------------------------------------
/JS/NodeJS/05_node_express/learn-express/views/index.pug:
--------------------------------------------------------------------------------
1 | //- pug에서 변수를 사용하는 방법
2 | //- 1. Element뒤에 '='을 붙이고 한칸 띈후 사용. (텍스트로 들어감)
3 | //- 2. 텍스트 중간에 변수를 사용하고 싶다면 '#{}'을 한 후 사용. (텍스트로 들어감)
4 | extends layout
5 |
6 | block content
7 | h1= title
8 | p Welcome to #{title}
9 |
--------------------------------------------------------------------------------
/JS/NodeJS/05_node_express/learn-express/views/layout.pug:
--------------------------------------------------------------------------------
1 | doctype html
2 | html
3 | head
4 | title= title
5 | link(rel='stylesheet', href='/stylesheets/style.css')
6 | body
7 | block content
8 |
--------------------------------------------------------------------------------
/JS/NodeJS/06_node_mysql/learn-sequelize/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
--------------------------------------------------------------------------------
/JS/NodeJS/06_node_mysql/learn-sequelize/app.js:
--------------------------------------------------------------------------------
1 | var createError = require('http-errors');
2 | var express = require('express');
3 | var path = require('path');
4 | var cookieParser = require('cookie-parser');
5 | var logger = require('morgan');
6 |
7 | var indexRouter = require('./routes/index');
8 | var usersRouter = require('./routes/users');
9 | var commentsRouter = require('./routes/comments');
10 | var sequelize = require('./models').sequelize;
11 |
12 | var app = express();
13 | sequelize.sync();
14 |
15 | // view engine setup
16 | app.set('views', path.join(__dirname, 'views'));
17 | app.set('view engine', 'jade');
18 |
19 | app.use(logger('dev'));
20 | app.use(express.json());
21 | app.use(express.urlencoded({ extended: false }));
22 | app.use(cookieParser());
23 | app.use(express.static(path.join(__dirname, 'public')));
24 |
25 | app.use('/', indexRouter);
26 | app.use('/users', usersRouter);
27 | app.use('/comments', commentsRouter);
28 |
29 | // catch 404 and forward to error handler
30 | app.use(function(req, res, next) {
31 | next(createError(404));
32 | });
33 |
34 | // error handler
35 | app.use(function(err, req, res, next) {
36 | // set locals, only providing error in development
37 | res.locals.message = err.message;
38 | res.locals.error = req.app.get('env') === 'development' ? err : {};
39 |
40 | // render the error page
41 | res.status(err.status || 500);
42 | res.render('error');
43 | });
44 |
45 | module.exports = app;
46 |
--------------------------------------------------------------------------------
/JS/NodeJS/06_node_mysql/learn-sequelize/config/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "development": {
3 | "username": "root",
4 | "password": "Fksdn4806@",
5 | "database": "nodejs",
6 | "host": "127.0.0.1",
7 | "dialect": "mysql",
8 | "operatorsAliases": false
9 | },
10 | "test": {
11 | "username": "root",
12 | "password": null,
13 | "database": "database_test",
14 | "host": "127.0.0.1",
15 | "dialect": "mysql"
16 | },
17 | "production": {
18 | "username": "root",
19 | "password": null,
20 | "database": "database_production",
21 | "host": "127.0.0.1",
22 | "dialect": "mysql"
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/JS/NodeJS/06_node_mysql/learn-sequelize/models/comment.js:
--------------------------------------------------------------------------------
1 | module.exports = (sequelize, DataTypes) => {
2 | return sequelize.define('comment', {
3 | comment: {
4 | type: DataTypes.STRING(100),
5 | allowNull: false,
6 | },
7 | created_at: {
8 | type: DataTypes.DATE,
9 | allowNull: true,
10 | defaultValue: DataTypes.NOW,
11 | },
12 | }, {
13 | timestamps: false,
14 | });
15 | };
--------------------------------------------------------------------------------
/JS/NodeJS/06_node_mysql/learn-sequelize/models/index.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const Sequelize = require('sequelize');
3 |
4 | const env = process.env.NODE_ENV || 'development';
5 | const config = require(path.join(__dirname, '..', 'config', 'config.json'))[env];
6 | const db = {};
7 |
8 | const sequelize =new Sequelize(config.database, config.username, config.password, config);
9 |
10 | db.sequelize = sequelize;
11 | db.Sequelize = Sequelize;
12 |
13 | db.User = require('./user')(sequelize, Sequelize);
14 | db.Comment = require('./comment')(sequelize, Sequelize);
15 |
16 | // 1:N 상황
17 | db.User.hasMany(db.Comment, { foreignKey: 'commenter', sourceKey: 'id' });
18 | db.Comment.belongsTo(db.User, { foreignKey: 'commenter', targetKey: 'id' });
19 |
20 | /* 1:1 상황 - 프로젝트와 상관 없음.
21 |
22 | * 사용자 정보를 담고 있는 가상의 Info 모델.
23 | * db.User.hasOne(db.Info, { foreignKey: 'user_id', sourceKey: 'id });
24 | * db.Info.belongsTo(db.User, { foreignKey: 'user_id', targetKey: 'id' });
25 | *
26 | */
27 |
28 | /* N:M 상황 - 프로젝트와 상관 없음.
29 |
30 | * 게시글 정보를 담고 있는 가상의 Post 모델.
31 | * 해시태그 정보를 담고 있는 가상의 Hashtag 모델.
32 | * db.Post.belongsToMany(db.Hashtag, { through: 'PostHashtag' });
33 | * db.Hashtag.belongsToMany(db.Post, { through: 'PostHashtag' });
34 | *
35 | * async (req, res, next) => {
36 | * const tag = await Hashtag.find({where: {title: '노드'}});
37 | * cosnt posts = await tag.getPosts(); // getPosts()메서드는 get + 모델 이름의 복수형
38 | * }
39 | */
40 |
41 | module.exports = db;
42 |
--------------------------------------------------------------------------------
/JS/NodeJS/06_node_mysql/learn-sequelize/models/user.js:
--------------------------------------------------------------------------------
1 | module.exports = (sequelize, DataTypes) => {
2 | return sequelize.define('user', {
3 | name: {
4 | type: DataTypes.STRING(20),
5 | allowNull: false,
6 | unique: true,
7 | },
8 | age: {
9 | type: DataTypes.INTEGER.UNSIGNED,
10 | allowNull: false,
11 | },
12 | married: {
13 | type: DataTypes.BOOLEAN,
14 | allowNull: false,
15 | },
16 | comment: {
17 | type: DataTypes.TEXT,
18 | allowNull: true,
19 | },
20 | created_at: {
21 | type: DataTypes.DATE,
22 | allowNull: false,
23 | defaultValue: DataTypes.NOW,
24 | },
25 | }, {
26 | timestamps: false,
27 | });
28 | };
--------------------------------------------------------------------------------
/JS/NodeJS/06_node_mysql/learn-sequelize/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "learn-sequelize",
3 | "version": "0.0.0",
4 | "private": true,
5 | "scripts": {
6 | "start": "node ./bin/www"
7 | },
8 | "dependencies": {
9 | "cookie-parser": "~1.4.3",
10 | "debug": "~2.6.9",
11 | "express": "~4.16.0",
12 | "http-errors": "~1.6.2",
13 | "jade": "~1.11.0",
14 | "morgan": "~1.9.0",
15 | "mysql2": "^1.6.4",
16 | "sequelize": "^4.42.0"
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/JS/NodeJS/06_node_mysql/learn-sequelize/public/stylesheets/style.css:
--------------------------------------------------------------------------------
1 | body {
2 | padding: 50px;
3 | font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
4 | }
5 |
6 | a {
7 | color: #00B7FF;
8 | }
9 |
--------------------------------------------------------------------------------
/JS/NodeJS/06_node_mysql/learn-sequelize/routes/comments.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var { User, Comment } = require('../models');
3 |
4 | var router = express.Router();
5 |
6 | router.get('/:id', async (req, res, next) => {
7 | try {
8 | // const id = req.params.id;
9 | const comments = await Comment.findAll({
10 | include: {
11 | model: User,
12 | where: { id: req.params.id },
13 | }
14 | });
15 | res.json(comments);
16 | } catch (error) {
17 | console.log(error);
18 | next(error);
19 | }
20 | });
21 |
22 | router.post('/', async (req, res, next) => {
23 | try {
24 | const result = await Comment.create({
25 | commenter: req.body.id,
26 | comment: req.body.comment,
27 | });
28 | console.log(result);
29 | res.status(201).json(result);
30 | } catch (error) {
31 | console.log(error);
32 | next(error);
33 | }
34 | });
35 |
36 | router.patch('/:id', async (req, res, next) => {
37 | try {
38 | const id = req.params.id;
39 | const result = await Comment.update({
40 | comment: req.body.comment
41 | }, {
42 | where: { id }
43 | });
44 | res.json(result);
45 | } catch (error) {
46 | console.log(error);
47 | next(error);
48 | }
49 | });
50 |
51 | router.delete('/:id', async (req, res, next) => {
52 | try {
53 | const id = req.params.id;
54 | const result = await Comment.destroy({ where: { id } })
55 | res.json(result);
56 | } catch (error) {
57 | console.log(error);
58 | next(error);
59 | }
60 | });
61 |
62 | module.exports = router;
--------------------------------------------------------------------------------
/JS/NodeJS/06_node_mysql/learn-sequelize/routes/index.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var User = require('../models').User;
3 |
4 | var router = express.Router();
5 |
6 | /* GET home page. */
7 | router.get('/', async (req, res, next) => {
8 | try {
9 | const users = await User.findAll();
10 | res.render('sequelize', { users });
11 | } catch (error) {
12 | console.log(error);
13 | next(error);
14 | }
15 | })
16 |
17 | module.exports = router;
18 |
--------------------------------------------------------------------------------
/JS/NodeJS/06_node_mysql/learn-sequelize/routes/users.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var User = require('../models').User;
3 |
4 | var router = express.Router();
5 |
6 | router.get('/', async (req, res, next) => {
7 | try {
8 | const users = await User.findAll();
9 | res.json(users);
10 | } catch (error) {
11 | console.log(error);
12 | next(error);
13 | }
14 | })
15 |
16 | router.post('/', async (req, res, next) => {
17 | try {
18 | const result = await User.create({
19 | name: req.body.name,
20 | age: req.body.age,
21 | married: req.body.married,
22 | });
23 | console.log(result);
24 | res.status(201).json(result);
25 | } catch (error) {
26 | console.log(error);
27 | next(error);
28 | }
29 | });
30 |
31 | module.exports = router;
32 |
--------------------------------------------------------------------------------
/JS/NodeJS/06_node_mysql/learn-sequelize/views/error.jade:
--------------------------------------------------------------------------------
1 | extends layout
2 |
3 | block content
4 | h1= message
5 | h2= error.status
6 | pre #{error.stack}
7 |
--------------------------------------------------------------------------------
/JS/NodeJS/06_node_mysql/learn-sequelize/views/index.jade:
--------------------------------------------------------------------------------
1 | extends layout
2 |
3 | block content
4 | h1= title
5 | p Welcome to #{title}
6 |
--------------------------------------------------------------------------------
/JS/NodeJS/06_node_mysql/learn-sequelize/views/layout.jade:
--------------------------------------------------------------------------------
1 | doctype html
2 | html
3 | head
4 | title= title
5 | link(rel='stylesheet', href='/stylesheets/style.css')
6 | body
7 | block content
8 |
--------------------------------------------------------------------------------
/JS/NodeJS/06_node_mysql/learn-sequelize/views/sequelize.jade:
--------------------------------------------------------------------------------
1 | doctype html
2 | html
3 | head
4 | meta(charset='utf-8')
5 | title 시퀄라이즈 서버
6 | style.
7 | table {
8 | border: 1px solid black;
9 | border-collapse: collapse;
10 | }
11 |
12 | table th, table td {
13 | border: 1px solid black;
14 | }
15 | body
16 | div
17 | form#user-form
18 | fieldset
19 | legend 사용자 등록
20 | div
21 | input#username(type="text" placeholder="이름")
22 | div
23 | input#age(type="number" placeholder="나이")
24 | div
25 | input#married(type="checkbox")
26 | label(for="married") 결혼 여부
27 | button(type="submit") 등록
28 | br
29 | table#user-list
30 | thead
31 | tr
32 | th 아이디
33 | th 이름
34 | th 나이
35 | th 결혼여부
36 | tbody
37 | for user in users
38 | tr
39 | td= user.id
40 | td= user.name
41 | td= user.age
42 | td= user.married ? '기혼' : '미혼'
43 | br
44 | div
45 | form#comment-form
46 | fieldset
47 | legend 댓글 등록
48 | div
49 | input#userid(type="text" placeholder="사용자 ID")
50 | div
51 | input#comment(type="text" placeholder="댓글")
52 | button(type="submit") 등록
53 | br
54 | table#comment-list
55 | thead
56 | tr
57 | th 아이디
58 | th 작성자
59 | th 댓글
60 | th 수정
61 | th 삭제
62 | tbody
63 | script(src='/sequelize.js')
--------------------------------------------------------------------------------
/JS/NodeJS/07_node_mongoDB/learn-mongoose/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
--------------------------------------------------------------------------------
/JS/NodeJS/07_node_mongoDB/learn-mongoose/app.js:
--------------------------------------------------------------------------------
1 | var createError = require('http-errors');
2 | var express = require('express');
3 | var path = require('path');
4 | var cookieParser = require('cookie-parser');
5 | var logger = require('morgan');
6 |
7 | var indexRouter = require('./routes/index');
8 | var usersRouter = require('./routes/users');
9 | var commentRouter = require('./routes/comments');
10 | var connect = require('./schemas');
11 |
12 | var app = express();
13 | connect();
14 |
15 | // view engine setup
16 | app.set('views', path.join(__dirname, 'views'));
17 | app.set('view engine', 'pug');
18 |
19 | app.use(logger('dev'));
20 | app.use(express.static(path.join(__dirname, 'public')));
21 | app.use(express.json());
22 | app.use(express.urlencoded({ extended: false }));
23 | app.use(cookieParser());
24 |
25 | app.use('/', indexRouter);
26 | app.use('/users', usersRouter);
27 | app.use('/comments', commentRouter);
28 |
29 | // catch 404 and forward to error handler
30 | app.use(function(req, res, next) {
31 | next(createError(404));
32 | });
33 |
34 | // error handler
35 | app.use(function(err, req, res, next) {
36 | // set locals, only providing error in development
37 | res.locals.message = err.message;
38 | res.locals.error = req.app.get('env') === 'development' ? err : {};
39 |
40 | // render the error page
41 | res.status(err.status || 500);
42 | res.render('error');
43 | });
44 |
45 | module.exports = app;
46 |
--------------------------------------------------------------------------------
/JS/NodeJS/07_node_mongoDB/learn-mongoose/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "learn-mongoose",
3 | "version": "0.0.0",
4 | "private": true,
5 | "scripts": {
6 | "start": "node ./bin/www"
7 | },
8 | "dependencies": {
9 | "cookie-parser": "~1.4.3",
10 | "debug": "~2.6.9",
11 | "express": "~4.16.0",
12 | "http-errors": "~1.6.2",
13 | "mongoose": "^5.4.9",
14 | "morgan": "~1.9.0",
15 | "pug": "2.0.0-beta11"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/JS/NodeJS/07_node_mongoDB/learn-mongoose/public/stylesheets/style.css:
--------------------------------------------------------------------------------
1 | body {
2 | padding: 50px;
3 | font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
4 | }
5 |
6 | a {
7 | color: #00B7FF;
8 | }
9 |
--------------------------------------------------------------------------------
/JS/NodeJS/07_node_mongoDB/learn-mongoose/routes/comments.js:
--------------------------------------------------------------------------------
1 | var express = require("express");
2 | var Comment = require("../schemas/comment");
3 |
4 | var router = express.Router();
5 |
6 | router.get("/:id", async (req, res, next) => {
7 | try {
8 | const comments = await Comment.find({ commenter: req.params.id }).populate(
9 | "commenter"
10 | );
11 | res.json(comments);
12 | } catch (error) {
13 | console.log(error);
14 | next(error);
15 | }
16 | });
17 |
18 | router.post('/', async (req, res, next) => {
19 | const comment = new Comment({
20 | commenter: req.body.id,
21 | comment: req.body.comment,
22 | });
23 | try {
24 | const commentSave = await comment.save();
25 | const result = await Comment.populate(commentSave, { path: 'commenter' });
26 | res.status(201).json(result);
27 | } catch (error) {
28 | console.log(error);
29 | next(error);
30 | }
31 | });
32 |
33 | router.patch('/:id', async (req, res, next) => {
34 | try{
35 | const result = await Comment.update({ _id: req.params.id }, { comment: req.body.comment });
36 | res.json(result);
37 | } catch (error) {
38 | console.log(error);
39 | next(error);
40 | }
41 | });
42 |
43 | router.delete('/:id', async (req, res, next) => {
44 | try {
45 | const result = await Comment.remove({ _id: req.params.id });
46 | res.json(result);
47 | } catch (error) {
48 | console.log(error);
49 | next(error);
50 | }
51 | });
52 |
53 | module.exports = router;
54 |
--------------------------------------------------------------------------------
/JS/NodeJS/07_node_mongoDB/learn-mongoose/routes/index.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var User = require('../schemas/user');
3 |
4 | var router = express.Router();
5 |
6 | /* GET home page. */
7 | router.get('/', async (req, res, next) => {
8 | try {
9 | const users = await User.find();
10 | res.render('mongoose', { users });
11 | } catch (error) {
12 | console.log(error);
13 | next(error);
14 | }
15 | });
16 |
17 | module.exports = router;
18 |
--------------------------------------------------------------------------------
/JS/NodeJS/07_node_mongoDB/learn-mongoose/routes/users.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var User = require('../schemas/user');
3 |
4 | var router = express.Router();
5 |
6 | /* GET users listing. */
7 | router.get('/', async (req, res, next) => {
8 | try {
9 | const users = await User.find();
10 | res.json(users);
11 | } catch (error) {
12 | console.log(error);
13 | next(error);
14 | }
15 | });
16 |
17 | router.post('/', async (req, res, next) => {
18 | const user = new User({
19 | name: req.body.name,
20 | age: req.body.age,
21 | married: req.body.married,
22 | });
23 | try {
24 | const result = await user.save();
25 | res.status(201).json(result);
26 | } catch (error) {
27 | console.log(error);
28 | next(error);
29 | }
30 | });
31 |
32 | module.exports = router;
33 |
--------------------------------------------------------------------------------
/JS/NodeJS/07_node_mongoDB/learn-mongoose/schemas/comment.js:
--------------------------------------------------------------------------------
1 | const mongoose = require('mongoose');
2 |
3 | const { Schema } = mongoose;
4 | const { Types: { ObjectId } } = Schema;
5 |
6 | const commentSchema = new Schema({
7 | commenter: {
8 | type: ObjectId,
9 | required: true,
10 | ref: 'User',
11 | },
12 | comment: {
13 | type: String,
14 | required: true,
15 | },
16 | createdAt: {
17 | type: Date,
18 | default: Date.now,
19 | },
20 | });
21 |
22 | module.exports = mongoose.model('Comment', commentSchema);
--------------------------------------------------------------------------------
/JS/NodeJS/07_node_mongoDB/learn-mongoose/schemas/index.js:
--------------------------------------------------------------------------------
1 | const mongoose = require('mongoose');
2 |
3 | module.exports = () => {
4 | const connect = () => {
5 | if (process.env.NODE_ENV !== 'production') {
6 | mongoose.set('debug', true);
7 | }
8 | mongoose.connect('mongodb://admin:admin@localhost:27017/admin', {
9 | dbName: 'nodejs',
10 | }, (error) => {
11 | if (error) {
12 | console.log('몽고 디비 연결 에러', error);
13 | } else {
14 | console.log('몽고 디비 연결 성공');
15 | }
16 | });
17 | };
18 |
19 | connect();
20 | mongoose.connection.on('error', (error) => {
21 | console.error('몽고디비 연결 에러', error);
22 | });
23 | mongoose.connection.on('disconnected', () => {
24 | console.log('몽고디비 연결이 끊겼습니다. 연결을 재시도 합니다.');
25 | connect();
26 | });
27 |
28 | require('./user');
29 | require('./comment');
30 | };
--------------------------------------------------------------------------------
/JS/NodeJS/07_node_mongoDB/learn-mongoose/schemas/user.js:
--------------------------------------------------------------------------------
1 | const mongoose = require('mongoose');
2 |
3 | const { Schema } = mongoose;
4 | const userSchema = new Schema({
5 | name: {
6 | type: String, // 타입
7 | required: true, // 필수 여부
8 | unique: true, // 고유값 여부
9 | },
10 | age: {
11 | type: Number,
12 | required: true,
13 | },
14 | married: {
15 | type: Boolean,
16 | required: true,
17 | },
18 | comment: String,
19 | createdAt: {
20 | type: Date,
21 | default: Date.now, // 기본 값
22 | },
23 | });
24 |
25 | module.exports = mongoose.model('User', userSchema);
--------------------------------------------------------------------------------
/JS/NodeJS/07_node_mongoDB/learn-mongoose/views/error.pug:
--------------------------------------------------------------------------------
1 | extends layout
2 |
3 | block content
4 | h1= message
5 | h2= error.status
6 | pre #{error.stack}
7 |
--------------------------------------------------------------------------------
/JS/NodeJS/07_node_mongoDB/learn-mongoose/views/index.pug:
--------------------------------------------------------------------------------
1 | extends layout
2 |
3 | block content
4 | h1= title
5 | p Welcome to #{title}
6 |
--------------------------------------------------------------------------------
/JS/NodeJS/07_node_mongoDB/learn-mongoose/views/layout.pug:
--------------------------------------------------------------------------------
1 | doctype html
2 | html
3 | head
4 | title= title
5 | link(rel='stylesheet', href='/stylesheets/style.css')
6 | body
7 | block content
8 |
--------------------------------------------------------------------------------
/JS/NodeJS/07_node_mongoDB/learn-mongoose/views/mongoose.pug:
--------------------------------------------------------------------------------
1 | doctype html
2 | html
3 | head
4 | meta(charset='utf-8')
5 | title 몽구스 서버
6 | style.
7 | table {
8 | border: 1px solid black;
9 | border-collapse: collapse;
10 | }
11 |
12 | table th, table td {
13 | border: 1px solid black;
14 | }
15 | body
16 | div
17 | form#user-form
18 | fieldset
19 | legend 사용자 등록
20 | div
21 | input#username(type="text" placeholder="이름")
22 | div
23 | input#age(type="number" placeholder="나이")
24 | div
25 | input#married(type="checkbox")
26 | label(for="married") 결혼 여부
27 | button(type="submit") 등록
28 | br
29 | table#user-list
30 | thead
31 | tr
32 | th 아이디
33 | th 이름
34 | th 나이
35 | th 결혼여부
36 | tbody
37 | for user in users
38 | tr
39 | td= user._id
40 | td= user.name
41 | td= user.age
42 | td= user.married ? '기혼' : '미혼'
43 | br
44 | div
45 | form#comment-form
46 | fieldset
47 | legend 댓글 등록
48 | div
49 | input#userid(type="text" placeholder="사용자 아이디")
50 | div
51 | input#comment(type="text" placeholder="댓글")
52 | button(type="submit") 등록
53 | br
54 | table#comment-list
55 | thead
56 | tr
57 | th 아이디
58 | th 작성자
59 | th 댓글
60 | th 수정
61 | th 삭제
62 | tbody
63 | script(src='/mongoose.js')
--------------------------------------------------------------------------------
/JS/NodeJS/08_node_snsService/nodebird/.env:
--------------------------------------------------------------------------------
1 | COOKIE_SECRET=nodebirdsecret
2 | KAKAO_ID=2be8d038041bce08691327ab86075c0f
3 | SEQUELIZE_PASSWORD=admin
4 | REDIS_HOST=redis-12357.c8.us-east-1-4.ec2.cloud.redislabs.com:12357
5 | REDIS_PORT=12357
6 | REDIS_PASSWORD=L6coSKew4GBAN0UN0xmXMkM0tTzXICSm
--------------------------------------------------------------------------------
/JS/NodeJS/08_node_snsService/nodebird/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
--------------------------------------------------------------------------------
/JS/NodeJS/08_node_snsService/nodebird/combined.log:
--------------------------------------------------------------------------------
1 | {"message":"Hello","level":"info"}
2 | {"message":"Not Found","level":"error"}
3 | {"message":"Hello","level":"info"}
4 | {"message":"Not Found","level":"error"}
5 |
--------------------------------------------------------------------------------
/JS/NodeJS/08_node_snsService/nodebird/config/config.js:
--------------------------------------------------------------------------------
1 | require('dotenv').config();
2 |
3 | module.exports = {
4 | development: {
5 | username: "root",
6 | password: process.env.SEQUELIZE_PASSWORD,
7 | database: "nodebird",
8 | host: "127.0.0.1",
9 | dialect: "mysql",
10 | operatorsAliases: 'false',
11 | },
12 | production: {
13 | username: "root",
14 | password: process.env.SEQUELIZE_PASSWORD,
15 | database: "nodebird",
16 | host: "127.0.0.1",
17 | dialect: "mysql",
18 | operatorsAliases: 'false',
19 | logging: false,
20 | },
21 | };
22 |
--------------------------------------------------------------------------------
/JS/NodeJS/08_node_snsService/nodebird/error.log:
--------------------------------------------------------------------------------
1 | {"message":"Not Found","level":"error"}
2 | {"message":"Not Found","level":"error"}
3 |
--------------------------------------------------------------------------------
/JS/NodeJS/08_node_snsService/nodebird/logger.js:
--------------------------------------------------------------------------------
1 | const { createLogger, format, transports } = require('winston');
2 |
3 | const logger = createLogger({
4 | level: 'info',
5 | format: format.json(),
6 | transports: [
7 | new transports.File({ filename: 'combined.log' }),
8 | new transports.File({ filename: 'error.log', level: 'error' }),
9 | ],
10 | });
11 |
12 | if (process.env.NODE_ENV !== 'production') {
13 | logger.add(new transports.Console({ format: format.simple() }));
14 | }
15 |
16 | module.exports = logger;
--------------------------------------------------------------------------------
/JS/NodeJS/08_node_snsService/nodebird/models/hashtag.js:
--------------------------------------------------------------------------------
1 | module.exports = (sequelize, DataTypes) => (
2 | sequelize.define('hastag', {
3 | title: {
4 | type: DataTypes.STRING(15),
5 | allowNull: false,
6 | unique: true,
7 | },
8 | }, {
9 | timestamps: true,
10 | paranoid: true,
11 | charset: 'utf8',
12 | collate: 'utf8_general_ci',
13 | })
14 | );
--------------------------------------------------------------------------------
/JS/NodeJS/08_node_snsService/nodebird/models/index.js:
--------------------------------------------------------------------------------
1 | const Sequelize = require("sequelize");
2 | const env = process.env.NODE_ENV || "development";
3 | const config = require("../config/config")[env];
4 | const db = {};
5 |
6 | const sequelize = new Sequelize(
7 | config.database,
8 | config.username,
9 | config.password,
10 | config
11 | );
12 |
13 | db.sequelize = sequelize;
14 | db.Sequelize = Sequelize;
15 |
16 | db.User = require("./user")(sequelize, Sequelize);
17 | db.Post = require("./post")(sequelize, Sequelize);
18 | db.Hashtag = require("./hashtag")(sequelize, Sequelize);
19 |
20 | db.User.hasMany(db.Post);
21 | db.Post.belongsTo(db.User);
22 | db.Post.belongsToMany(db.Hashtag, { through: "PostHashtag" });
23 | db.Hashtag.belongsToMany(db.Post, { through: "PostHashtag" });
24 | db.User.belongsToMany(db.User, {
25 | foreignKey: "followingId",
26 | as: "Followers",
27 | through: "Follow"
28 | });
29 | db.User.belongsToMany(db.User, {
30 | foreignKey: "followerId",
31 | as: "Followings",
32 | through: "Follow"
33 | });
34 |
35 | module.exports = db;
36 |
--------------------------------------------------------------------------------
/JS/NodeJS/08_node_snsService/nodebird/models/post.js:
--------------------------------------------------------------------------------
1 | module.exports = (sequelize, DataTypes) => (
2 | sequelize.define('post', {
3 | content: {
4 | type: DataTypes.STRING(140),
5 | allowNull: false,
6 | },
7 | img: {
8 | type: DataTypes.STRING(200),
9 | allowNull: true,
10 | },
11 | }, {
12 | timestamps: true,
13 | paranoid: true,
14 | charset: 'utf8',
15 | collate: 'utf8_general_ci',
16 | })
17 | );
--------------------------------------------------------------------------------
/JS/NodeJS/08_node_snsService/nodebird/models/user.js:
--------------------------------------------------------------------------------
1 | module.exports = (sequelize, DataTypes) => (
2 | sequelize.define('user', {
3 | email: {
4 | type: DataTypes.STRING(40),
5 | allowNull: false,
6 | uniqeu: true,
7 | },
8 | nick: {
9 | type: DataTypes.STRING(15),
10 | allowNull: false,
11 | },
12 | password: {
13 | type: DataTypes.STRING(100),
14 | allowNull: true,
15 | },
16 | provider: {
17 | type: DataTypes.STRING(10),
18 | allowNull: false,
19 | defaultValue: 'local',
20 | },
21 | snsId: {
22 | type: DataTypes.STRING(30),
23 | allowNull: true,
24 | },
25 | }, {
26 | timestamps: true,
27 | paranoid: true,
28 | charset: 'utf8',
29 | collate: 'utf8_general_ci',
30 | })
31 | );
--------------------------------------------------------------------------------
/JS/NodeJS/08_node_snsService/nodebird/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "nodebird",
3 | "version": "0.0.1",
4 | "description": "익스프레스로 만드는 SNS 서비스",
5 | "main": "app.js",
6 | "scripts": {
7 | "start": "cross-env NODE_ENV=production PORT=80 pm2 start app.js -i 0",
8 | "dev": "nodemon app"
9 | },
10 | "author": "JunuKimDev",
11 | "license": "ISC",
12 | "dependencies": {
13 | "bcrypt": "^3.0.4",
14 | "connect-flash": "^0.1.1",
15 | "connect-redis": "^3.4.0",
16 | "cookie-parser": "^1.4.3",
17 | "cross-env": "^5.2.0",
18 | "dotenv": "^6.2.0",
19 | "express": "^4.16.4",
20 | "express-session": "^1.15.6",
21 | "helmet": "^3.15.1",
22 | "hpp": "^0.2.2",
23 | "morgan": "^1.9.1",
24 | "multer": "^1.4.1",
25 | "mysql2": "^1.6.4",
26 | "passport": "^0.4.0",
27 | "passport-kakao": "0.0.5",
28 | "passport-local": "^1.0.0",
29 | "pm2": "^3.2.9",
30 | "pug": "^2.0.3",
31 | "sequelize": "^4.42.0",
32 | "winston": "^3.2.1"
33 | },
34 | "devDependencies": {
35 | "nodemon": "^1.18.9"
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/JS/NodeJS/08_node_snsService/nodebird/passport/index.js:
--------------------------------------------------------------------------------
1 | const local = require('./localStrategy');
2 | const kakao = require('./kakaoStrategy');
3 | const { User } = require('../models');
4 |
5 | module.exports = (passport) => {
6 | passport.serializeUser((user, done) => {
7 | done(null, user.id); // done('에러 발생 시', '세션에 등록할 데이터');
8 | });
9 |
10 | passport.deserializeUser((id, done) => {
11 | User.find({
12 | where: { id },
13 | include: [{
14 | model: User,
15 | attributes: ['id', 'nick'],
16 | as: 'Followers',
17 | }, {
18 | model: User,
19 | attributes: ['id', 'nick'],
20 | as: 'Followings',
21 | }],
22 | })
23 | .then(user => done(null, user))
24 | .catch(err => done(err));
25 | });
26 |
27 | local(passport);
28 | kakao(passport);
29 | }
30 |
--------------------------------------------------------------------------------
/JS/NodeJS/08_node_snsService/nodebird/passport/kakaoStrategy.js:
--------------------------------------------------------------------------------
1 | const KakaoStrategy = require('passport-kakao').Strategy;
2 |
3 | const { User } = require('../models');
4 |
5 | module.exports = (passport) => {
6 | passport.use(new KakaoStrategy({
7 | clientID: process.env.KAKAO_ID,
8 | callbackURL: '/auth/kakao/callback',
9 | }, async (accessToken, refreshToken, profile, done) => {
10 | try {
11 | const exUser = await User.find({ where: { snsId: profile.id, provider: 'kakao' } });
12 | if (exUser) {
13 | done(null, exUser);
14 | } else {
15 | const newUser = await User.create({
16 | email: profile._json && profile._json.kaccount_email,
17 | nick: profile.displayName,
18 | snsId: profile.id,
19 | provider: 'kakao',
20 | });
21 | done(null, newUser);
22 | }
23 | } catch (error) {
24 | console.error(error);
25 | done(error);
26 | }
27 | }));
28 | };
--------------------------------------------------------------------------------
/JS/NodeJS/08_node_snsService/nodebird/passport/localStrategy.js:
--------------------------------------------------------------------------------
1 | const LocalStrategy = require('passport-local').Strategy;
2 | const bcrypt = require('bcrypt');
3 |
4 | const { User } = require('../models');
5 |
6 | module.exports = (passport) => {
7 | passport.use(new LocalStrategy({
8 | usernameField: 'email',
9 | passwordField: 'password',
10 | }, async (email, password, done) => {
11 | try {
12 | const exUser = await User.find({ where: { email }});
13 | if (exUser) {
14 | const result = await bcrypt.compare(password, exUser.password);
15 | if (result) {
16 | done(null, exUser);
17 | } else {
18 | done(null, false, { message: '비밀번호가 일치하지 않습니다.' });
19 | }
20 | } else {
21 | done(null, false, { message: '가입되지 않은 회원입니다.' });
22 | }
23 | } catch (error) {
24 | console.error(error);
25 | done(error);
26 | }
27 | }));
28 | };
--------------------------------------------------------------------------------
/JS/NodeJS/08_node_snsService/nodebird/routes/middlewares.js:
--------------------------------------------------------------------------------
1 | exports.isLoggedIn = (req, res, next) => {
2 | if (req.isAuthenticated()) {
3 | next();
4 | } else {
5 | res.status(403).send("로그인 필요");
6 | }
7 | };
8 |
9 | exports.isNotLoggedIn = (req, res, next) => {
10 | if (!req.isAuthenticated()) {
11 | next();
12 | } else {
13 | res.redirect("/");
14 | }
15 | };
16 |
--------------------------------------------------------------------------------
/JS/NodeJS/08_node_snsService/nodebird/routes/page.js:
--------------------------------------------------------------------------------
1 | const express = require("express");
2 | const { isLoggedIn, isNotLoggedIn } = require('./middlewares');
3 | const { User, Post } = require('../models');
4 |
5 | const router = express.Router();
6 |
7 | router.get("/profile", isLoggedIn, (req, res) => {
8 | res.render("profile", { title: "내 정보 - NodeBird", user: req.user });
9 | });
10 |
11 | router.get("/join", isNotLoggedIn, (req, res) => {
12 | res.render("join", {
13 | title: "회원가입 - NodeBird",
14 | user: req.user,
15 | joinError: req.flash("joinError")
16 | });
17 | });
18 |
19 | router.get("/", async (req, res, next) => {
20 | try {
21 | const posts = await Post.findAll({
22 | include: {
23 | model: User,
24 | attributes: ['id', 'nick'],
25 | },
26 | order: [['createdAt', "DESC"]],
27 | });
28 |
29 | res.render('main', {
30 | titel: 'NodeBird',
31 | twits: posts,
32 | user: req.user,
33 | loginError: req.flash('loginError'),
34 | });
35 | } catch (error) {
36 | console.error(error);
37 | next(error);
38 | }
39 | });
40 |
41 | module.exports = router;
42 |
--------------------------------------------------------------------------------
/JS/NodeJS/08_node_snsService/nodebird/routes/user.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 |
3 | const { isLoggedIn } = require('./middlewares');
4 | const { User } = require('../models');
5 |
6 | const router = express.Router();
7 |
8 | router.post('/:id/follow', isLoggedIn, async (req, res, next) => {
9 | try{
10 | const user = await User.find({ where: { id: req.user.id } });
11 | await user.addFollowing(parseInt(req.params.id, 10));
12 | res.send('success');
13 | } catch (error) {
14 | console.log(error);
15 | next(error);
16 | }
17 | });
18 |
19 | module.exports = router;
--------------------------------------------------------------------------------
/JS/NodeJS/08_node_snsService/nodebird/views/error.pug:
--------------------------------------------------------------------------------
1 | extends layout
2 |
3 | block content
4 | h1= message
5 | h2= error.status
6 | pre #{error.stack}
--------------------------------------------------------------------------------
/JS/NodeJS/08_node_snsService/nodebird/views/join.pug:
--------------------------------------------------------------------------------
1 | extends layout
2 |
3 | block content
4 | .timeline
5 | form#join-form(action='/auth/join' method='post')
6 | .input-group
7 | label(for='join-email') 이메일
8 | input#join-email(type='email' name='email')
9 | .input-group
10 | label(for='join-nick') 닉네임
11 | input#join-nick(type='text' name='nick')
12 | .input-group
13 | label(for='join-password') 비밀번호
14 | input#join-password(type='password' name='password')
15 | if joinError
16 | .error-message= joinError
17 | button#join-btn.btn(type='submit') 회원가입
--------------------------------------------------------------------------------
/JS/NodeJS/08_node_snsService/nodebird/views/layout.pug:
--------------------------------------------------------------------------------
1 | doctype
2 | html
3 | head
4 | meta(charset='UTF-8')
5 | title= title
6 | meta(name='viewport' content='width=device-width, user-scalable=no')
7 | meta(http-equiv='X-UA-Compatible' content='IE=edge')
8 | link(rel='stylesheet' href='/main.css')
9 | body
10 | .container
11 | .profile-wrap
12 | .profile
13 | if user && user.id
14 | .user-name= '안녕하세요! ' + user.nick + '님'
15 | .half
16 | div 팔로잉
17 | .count.following-count= user.Followings && user.Followings.length || 0
18 | .half
19 | div 팔로워
20 | .count.follower-count= user.Followers && user.Followers.length || 0
21 | input#my-id(type='hidden' value=user.id)
22 | a#my-profile.btn(href='/profile') 내 프로필
23 | a#logout.btn(href='/auth/logout') 로그아웃
24 | else
25 | form#login-form(action='/auth/login' method='post')
26 | .input-group
27 | label(for='email') 이메일
28 | input#email(type='email' name='email' required autofocus)
29 | .input-group
30 | label(for='password') 비밀번호
31 | input#password(type='password' name='password' required)
32 | if loginError
33 | .error-message= loginError
34 | a#join.btn(href='/join') 회원가입
35 | button#login.btn(type='submit') 로그인
36 | a#kakao.btn(href='/auth/kakao') 카카오톡
37 | footer
38 | | Made by
39 | a(href='https://www.zerocho.com' target='_blank') ZeroCho
40 | block content
--------------------------------------------------------------------------------
/JS/NodeJS/08_node_snsService/nodebird/views/profile.pug:
--------------------------------------------------------------------------------
1 | extends layout
2 |
3 | block content
4 | .timeline
5 | .followings.half
6 | h2 팔로잉 목록
7 | if user.Followings
8 | for following in user.Followings
9 | div= following.nick
10 | .followers.half
11 | h2 팔로워 목록
12 | if user.Followers
13 | for follower in user.Followers
14 | div= follower.nick
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/.env:
--------------------------------------------------------------------------------
1 | COOKIE_SECRET=nodebirdsecret
2 | KAKAO_ID=2be8d038041bce08691327ab86075c0f
3 | JWT_SECRET=jwtSecret
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "nodbird apidocs",
3 | "verson": "0.0.1",
4 | "description": "nodebird apidocs",
5 | "title": "My First Apidocs"
6 | }
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/api_project.js:
--------------------------------------------------------------------------------
1 | define({
2 | "name": "nodbird apidocs",
3 | "version": "0.0.1",
4 | "description": "nodebird apidocs",
5 | "verson": "0.0.1",
6 | "title": "My First Apidocs",
7 | "sampleUrl": false,
8 | "defaultVersion": "0.0.0",
9 | "apidoc": "0.3.0",
10 | "generator": {
11 | "name": "apidoc",
12 | "time": "2019-02-13T15:17:01.475Z",
13 | "url": "http://apidocjs.com",
14 | "version": "0.17.7"
15 | }
16 | });
17 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/api_project.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "nodbird apidocs",
3 | "version": "0.0.1",
4 | "description": "nodebird apidocs",
5 | "verson": "0.0.1",
6 | "title": "My First Apidocs",
7 | "sampleUrl": false,
8 | "defaultVersion": "0.0.0",
9 | "apidoc": "0.3.0",
10 | "generator": {
11 | "name": "apidoc",
12 | "time": "2019-02-13T15:17:01.475Z",
13 | "url": "http://apidocjs.com",
14 | "version": "0.17.7"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junu126/TIL_JS/54f4b52fb330557c600e6e53c2bc98d4002ac56d/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junu126/TIL_JS/54f4b52fb330557c600e6e53c2bc98d4002ac56d/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junu126/TIL_JS/54f4b52fb330557c600e6e53c2bc98d4002ac56d/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/fonts/glyphicons-halflings-regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junu126/TIL_JS/54f4b52fb330557c600e6e53c2bc98d4002ac56d/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/fonts/glyphicons-halflings-regular.woff2
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/img/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junu126/TIL_JS/54f4b52fb330557c600e6e53c2bc98d4002ac56d/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/img/favicon.ico
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/locales/ca.js:
--------------------------------------------------------------------------------
1 | define({
2 | ca: {
3 | 'Allowed values:' : 'Valors permesos:',
4 | 'Compare all with predecessor': 'Comparar tot amb versió anterior',
5 | 'compare changes to:' : 'comparar canvis amb:',
6 | 'compared to' : 'comparat amb',
7 | 'Default value:' : 'Valor per defecte:',
8 | 'Description' : 'Descripció',
9 | 'Field' : 'Camp',
10 | 'General' : 'General',
11 | 'Generated with' : 'Generat amb',
12 | 'Name' : 'Nom',
13 | 'No response values.' : 'Sense valors en la resposta.',
14 | 'optional' : 'opcional',
15 | 'Parameter' : 'Paràmetre',
16 | 'Permission:' : 'Permisos:',
17 | 'Response' : 'Resposta',
18 | 'Send' : 'Enviar',
19 | 'Send a Sample Request' : 'Enviar una petició d\'exemple',
20 | 'show up to version:' : 'mostrar versió:',
21 | 'Size range:' : 'Tamany de rang:',
22 | 'Type' : 'Tipus',
23 | 'url' : 'url'
24 | }
25 | });
26 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/locales/cs.js:
--------------------------------------------------------------------------------
1 | define({
2 | cs: {
3 | 'Allowed values:' : 'Povolené hodnoty:',
4 | 'Compare all with predecessor': 'Porovnat vše s předchozími verzemi',
5 | 'compare changes to:' : 'porovnat změny s:',
6 | 'compared to' : 'porovnat s',
7 | 'Default value:' : 'Výchozí hodnota:',
8 | 'Description' : 'Popis',
9 | 'Field' : 'Pole',
10 | 'General' : 'Obecné',
11 | 'Generated with' : 'Vygenerováno pomocí',
12 | 'Name' : 'Název',
13 | 'No response values.' : 'Nebyly vráceny žádné hodnoty.',
14 | 'optional' : 'volitelné',
15 | 'Parameter' : 'Parametr',
16 | 'Permission:' : 'Oprávnění:',
17 | 'Response' : 'Odpověď',
18 | 'Send' : 'Odeslat',
19 | 'Send a Sample Request' : 'Odeslat ukázkový požadavek',
20 | 'show up to version:' : 'zobrazit po verzi:',
21 | 'Size range:' : 'Rozsah velikosti:',
22 | 'Type' : 'Typ',
23 | 'url' : 'url'
24 | }
25 | });
26 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/locales/de.js:
--------------------------------------------------------------------------------
1 | define({
2 | de: {
3 | 'Allowed values:' : 'Erlaubte Werte:',
4 | 'Compare all with predecessor': 'Vergleiche alle mit ihren Vorgängern',
5 | 'compare changes to:' : 'vergleiche Änderungen mit:',
6 | 'compared to' : 'verglichen mit',
7 | 'Default value:' : 'Standardwert:',
8 | 'Description' : 'Beschreibung',
9 | 'Field' : 'Feld',
10 | 'General' : 'Allgemein',
11 | 'Generated with' : 'Erstellt mit',
12 | 'Name' : 'Name',
13 | 'No response values.' : 'Keine Rückgabewerte.',
14 | 'optional' : 'optional',
15 | 'Parameter' : 'Parameter',
16 | 'Permission:' : 'Berechtigung:',
17 | 'Response' : 'Antwort',
18 | 'Send' : 'Senden',
19 | 'Send a Sample Request' : 'Eine Beispielanfrage senden',
20 | 'show up to version:' : 'zeige bis zur Version:',
21 | 'Size range:' : 'Größenbereich:',
22 | 'Type' : 'Typ',
23 | 'url' : 'url'
24 | }
25 | });
26 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/locales/es.js:
--------------------------------------------------------------------------------
1 | define({
2 | es: {
3 | 'Allowed values:' : 'Valores permitidos:',
4 | 'Compare all with predecessor': 'Comparar todo con versión anterior',
5 | 'compare changes to:' : 'comparar cambios con:',
6 | 'compared to' : 'comparado con',
7 | 'Default value:' : 'Valor por defecto:',
8 | 'Description' : 'Descripción',
9 | 'Field' : 'Campo',
10 | 'General' : 'General',
11 | 'Generated with' : 'Generado con',
12 | 'Name' : 'Nombre',
13 | 'No response values.' : 'Sin valores en la respuesta.',
14 | 'optional' : 'opcional',
15 | 'Parameter' : 'Parámetro',
16 | 'Permission:' : 'Permisos:',
17 | 'Response' : 'Respuesta',
18 | 'Send' : 'Enviar',
19 | 'Send a Sample Request' : 'Enviar una petición de ejemplo',
20 | 'show up to version:' : 'mostrar a versión:',
21 | 'Size range:' : 'Tamaño de rango:',
22 | 'Type' : 'Tipo',
23 | 'url' : 'url'
24 | }
25 | });
26 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/locales/fr.js:
--------------------------------------------------------------------------------
1 | define({
2 | fr: {
3 | 'Allowed values:' : 'Valeurs autorisées :',
4 | 'Compare all with predecessor': 'Tout comparer avec ...',
5 | 'compare changes to:' : 'comparer les changements à :',
6 | 'compared to' : 'comparer à',
7 | 'Default value:' : 'Valeur par défaut :',
8 | 'Description' : 'Description',
9 | 'Field' : 'Champ',
10 | 'General' : 'Général',
11 | 'Generated with' : 'Généré avec',
12 | 'Name' : 'Nom',
13 | 'No response values.' : 'Aucune valeur de réponse.',
14 | 'optional' : 'optionnel',
15 | 'Parameter' : 'Paramètre',
16 | 'Permission:' : 'Permission :',
17 | 'Response' : 'Réponse',
18 | 'Send' : 'Envoyer',
19 | 'Send a Sample Request' : 'Envoyer une requête représentative',
20 | 'show up to version:' : 'Montrer à partir de la version :',
21 | 'Size range:' : 'Ordre de grandeur :',
22 | 'Type' : 'Type',
23 | 'url' : 'url'
24 | }
25 | });
26 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/locales/it.js:
--------------------------------------------------------------------------------
1 | define({
2 | it: {
3 | 'Allowed values:' : 'Valori permessi:',
4 | 'Compare all with predecessor': 'Confronta tutto con versioni precedenti',
5 | 'compare changes to:' : 'confronta modifiche con:',
6 | 'compared to' : 'confrontato con',
7 | 'Default value:' : 'Valore predefinito:',
8 | 'Description' : 'Descrizione',
9 | 'Field' : 'Campo',
10 | 'General' : 'Generale',
11 | 'Generated with' : 'Creato con',
12 | 'Name' : 'Nome',
13 | 'No response values.' : 'Nessun valore di risposta.',
14 | 'optional' : 'opzionale',
15 | 'Parameter' : 'Parametro',
16 | 'Permission:' : 'Permessi:',
17 | 'Response' : 'Risposta',
18 | 'Send' : 'Invia',
19 | 'Send a Sample Request' : 'Invia una richiesta di esempio',
20 | 'show up to version:' : 'mostra alla versione:',
21 | 'Size range:' : 'Intervallo dimensione:',
22 | 'Type' : 'Tipo',
23 | 'url' : 'url'
24 | }
25 | });
26 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/locales/locale.js:
--------------------------------------------------------------------------------
1 | define([
2 | './locales/ca.js',
3 | './locales/cs.js',
4 | './locales/de.js',
5 | './locales/es.js',
6 | './locales/fr.js',
7 | './locales/it.js',
8 | './locales/nl.js',
9 | './locales/pl.js',
10 | './locales/pt_br.js',
11 | './locales/ro.js',
12 | './locales/ru.js',
13 | './locales/tr.js',
14 | './locales/vi.js',
15 | './locales/zh.js',
16 | './locales/zh_cn.js'
17 | ], function() {
18 | var langId = (navigator.language || navigator.userLanguage).toLowerCase().replace('-', '_');
19 | var language = langId.substr(0, 2);
20 | var locales = {};
21 |
22 | for (index in arguments) {
23 | for (property in arguments[index])
24 | locales[property] = arguments[index][property];
25 | }
26 | if ( ! locales['en'])
27 | locales['en'] = {};
28 |
29 | if ( ! locales[langId] && ! locales[language])
30 | language = 'en';
31 |
32 | var locale = (locales[langId] ? locales[langId] : locales[language]);
33 |
34 | function __(text) {
35 | var index = locale[text];
36 | if (index === undefined)
37 | return text;
38 | return index;
39 | };
40 |
41 | function setLanguage(language) {
42 | locale = locales[language];
43 | }
44 |
45 | return {
46 | __ : __,
47 | locales : locales,
48 | locale : locale,
49 | setLanguage: setLanguage
50 | };
51 | });
52 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/locales/nl.js:
--------------------------------------------------------------------------------
1 | define({
2 | nl: {
3 | 'Allowed values:' : 'Toegestane waarden:',
4 | 'Compare all with predecessor': 'Vergelijk alle met voorgaande versie',
5 | 'compare changes to:' : 'vergelijk veranderingen met:',
6 | 'compared to' : 'vergelijk met',
7 | 'Default value:' : 'Standaard waarde:',
8 | 'Description' : 'Omschrijving',
9 | 'Field' : 'Veld',
10 | 'General' : 'Algemeen',
11 | 'Generated with' : 'Gegenereerd met',
12 | 'Name' : 'Naam',
13 | 'No response values.' : 'Geen response waardes.',
14 | 'optional' : 'optioneel',
15 | 'Parameter' : 'Parameter',
16 | 'Permission:' : 'Permissie:',
17 | 'Response' : 'Antwoorden',
18 | 'Send' : 'Sturen',
19 | 'Send a Sample Request' : 'Stuur een sample aanvragen',
20 | 'show up to version:' : 'toon tot en met versie:',
21 | 'Size range:' : 'Maatbereik:',
22 | 'Type' : 'Type',
23 | 'url' : 'url'
24 | }
25 | });
26 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/locales/pl.js:
--------------------------------------------------------------------------------
1 | define({
2 | pl: {
3 | 'Allowed values:' : 'Dozwolone wartości:',
4 | 'Compare all with predecessor': 'Porównaj z poprzednimi wersjami',
5 | 'compare changes to:' : 'porównaj zmiany do:',
6 | 'compared to' : 'porównaj do:',
7 | 'Default value:' : 'Wartość domyślna:',
8 | 'Description' : 'Opis',
9 | 'Field' : 'Pole',
10 | 'General' : 'Generalnie',
11 | 'Generated with' : 'Wygenerowano z',
12 | 'Name' : 'Nazwa',
13 | 'No response values.' : 'Brak odpowiedzi.',
14 | 'optional' : 'opcjonalny',
15 | 'Parameter' : 'Parametr',
16 | 'Permission:' : 'Uprawnienia:',
17 | 'Response' : 'Odpowiedź',
18 | 'Send' : 'Wyślij',
19 | 'Send a Sample Request' : 'Wyślij przykładowe żądanie',
20 | 'show up to version:' : 'pokaż do wersji:',
21 | 'Size range:' : 'Zakres rozmiaru:',
22 | 'Type' : 'Typ',
23 | 'url' : 'url'
24 | }
25 | });
26 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/locales/pt_br.js:
--------------------------------------------------------------------------------
1 | define({
2 | 'pt_br': {
3 | 'Allowed values:' : 'Valores permitidos:',
4 | 'Compare all with predecessor': 'Compare todos com antecessores',
5 | 'compare changes to:' : 'comparar alterações com:',
6 | 'compared to' : 'comparado com',
7 | 'Default value:' : 'Valor padrão:',
8 | 'Description' : 'Descrição',
9 | 'Field' : 'Campo',
10 | 'General' : 'Geral',
11 | 'Generated with' : 'Gerado com',
12 | 'Name' : 'Nome',
13 | 'No response values.' : 'Sem valores de resposta.',
14 | 'optional' : 'opcional',
15 | 'Parameter' : 'Parâmetro',
16 | 'Permission:' : 'Permissão:',
17 | 'Response' : 'Resposta',
18 | 'Send' : 'Enviar',
19 | 'Send a Sample Request' : 'Enviar um Exemplo de Pedido',
20 | 'show up to version:' : 'aparecer para a versão:',
21 | 'Size range:' : 'Faixa de tamanho:',
22 | 'Type' : 'Tipo',
23 | 'url' : 'url'
24 | }
25 | });
26 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/locales/ro.js:
--------------------------------------------------------------------------------
1 | define({
2 | ro: {
3 | 'Allowed values:' : 'Valori permise:',
4 | 'Compare all with predecessor': 'Compară toate cu versiunea precedentă',
5 | 'compare changes to:' : 'compară cu versiunea:',
6 | 'compared to' : 'comparat cu',
7 | 'Default value:' : 'Valoare implicită:',
8 | 'Description' : 'Descriere',
9 | 'Field' : 'Câmp',
10 | 'General' : 'General',
11 | 'Generated with' : 'Generat cu',
12 | 'Name' : 'Nume',
13 | 'No response values.' : 'Nici o valoare returnată.',
14 | 'optional' : 'opțional',
15 | 'Parameter' : 'Parametru',
16 | 'Permission:' : 'Permisiune:',
17 | 'Response' : 'Răspuns',
18 | 'Send' : 'Trimite',
19 | 'Send a Sample Request' : 'Trimite o cerere de probă',
20 | 'show up to version:' : 'arată până la versiunea:',
21 | 'Size range:' : 'Interval permis:',
22 | 'Type' : 'Tip',
23 | 'url' : 'url'
24 | }
25 | });
26 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/locales/ru.js:
--------------------------------------------------------------------------------
1 | define({
2 | ru: {
3 | 'Allowed values:' : 'Допустимые значения:',
4 | 'Compare all with predecessor': 'Сравнить с предыдущей версией',
5 | 'compare changes to:' : 'сравнить с:',
6 | 'compared to' : 'в сравнении с',
7 | 'Default value:' : 'По умолчанию:',
8 | 'Description' : 'Описание',
9 | 'Field' : 'Название',
10 | 'General' : 'Общая информация',
11 | 'Generated with' : 'Сгенерировано с помощью',
12 | 'Name' : 'Название',
13 | 'No response values.' : 'Нет значений для ответа.',
14 | 'optional' : 'необязательный',
15 | 'Parameter' : 'Параметр',
16 | 'Permission:' : 'Разрешено:',
17 | 'Response' : 'Ответ',
18 | 'Send' : 'Отправить',
19 | 'Send a Sample Request' : 'Отправить тестовый запрос',
20 | 'show up to version:' : 'показать версию:',
21 | 'Size range:' : 'Ограничения:',
22 | 'Type' : 'Тип',
23 | 'url' : 'URL'
24 | }
25 | });
26 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/locales/tr.js:
--------------------------------------------------------------------------------
1 | define({
2 | tr: {
3 | 'Allowed values:' : 'İzin verilen değerler:',
4 | 'Compare all with predecessor': 'Tümünü öncekiler ile karşılaştır',
5 | 'compare changes to:' : 'değişiklikleri karşılaştır:',
6 | 'compared to' : 'karşılaştır',
7 | 'Default value:' : 'Varsayılan değer:',
8 | 'Description' : 'Açıklama',
9 | 'Field' : 'Alan',
10 | 'General' : 'Genel',
11 | 'Generated with' : 'Oluşturan',
12 | 'Name' : 'İsim',
13 | 'No response values.' : 'Dönüş verisi yok.',
14 | 'optional' : 'opsiyonel',
15 | 'Parameter' : 'Parametre',
16 | 'Permission:' : 'İzin:',
17 | 'Response' : 'Dönüş',
18 | 'Send' : 'Gönder',
19 | 'Send a Sample Request' : 'Örnek istek gönder',
20 | 'show up to version:' : 'bu versiyona kadar göster:',
21 | 'Size range:' : 'Boyut aralığı:',
22 | 'Type' : 'Tip',
23 | 'url' : 'url'
24 | }
25 | });
26 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/locales/vi.js:
--------------------------------------------------------------------------------
1 | define({
2 | vi: {
3 | 'Allowed values:' : 'Giá trị chấp nhận:',
4 | 'Compare all with predecessor': 'So sánh với tất cả phiên bản trước',
5 | 'compare changes to:' : 'so sánh sự thay đổi với:',
6 | 'compared to' : 'so sánh với',
7 | 'Default value:' : 'Giá trị mặc định:',
8 | 'Description' : 'Chú thích',
9 | 'Field' : 'Trường dữ liệu',
10 | 'General' : 'Tổng quan',
11 | 'Generated with' : 'Được tạo bởi',
12 | 'Name' : 'Tên',
13 | 'No response values.' : 'Không có kết quả trả về.',
14 | 'optional' : 'Tùy chọn',
15 | 'Parameter' : 'Tham số',
16 | 'Permission:' : 'Quyền hạn:',
17 | 'Response' : 'Kết quả',
18 | 'Send' : 'Gửi',
19 | 'Send a Sample Request' : 'Gửi một yêu cầu mẫu',
20 | 'show up to version:' : 'hiển thị phiên bản:',
21 | 'Size range:' : 'Kích cỡ:',
22 | 'Type' : 'Kiểu',
23 | 'url' : 'liên kết'
24 | }
25 | });
26 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/locales/zh.js:
--------------------------------------------------------------------------------
1 | define({
2 | zh: {
3 | 'Allowed values:' : '允許值:',
4 | 'Compare all with predecessor': '預先比較所有',
5 | 'compare changes to:' : '比較變更:',
6 | 'compared to' : '對比',
7 | 'Default value:' : '默認值:',
8 | 'Description' : '描述',
9 | 'Field' : '字段',
10 | 'General' : '概括',
11 | 'Generated with' : '生成工具',
12 | 'Name' : '名稱',
13 | 'No response values.' : '無對應資料.',
14 | 'optional' : '選項',
15 | 'Parameter' : '參數',
16 | 'Permission:' : '允許:',
17 | 'Response' : '回應',
18 | 'Send' : '發送',
19 | 'Send a Sample Request' : '發送試用需求',
20 | 'show up to version:' : '顯示到版本:',
21 | 'Size range:' : '尺寸範圍:',
22 | 'Type' : '類型',
23 | 'url' : '網址'
24 | }
25 | });
26 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/locales/zh_cn.js:
--------------------------------------------------------------------------------
1 | define({
2 | 'zh_cn': {
3 | 'Allowed values:' : '允许值:',
4 | 'Compare all with predecessor': '与所有较早的比较',
5 | 'compare changes to:' : '将当前版本与指定版本比较:',
6 | 'compared to' : '相比于',
7 | 'Default value:' : '默认值:',
8 | 'Description' : '描述',
9 | 'Field' : '字段',
10 | 'General' : '概要',
11 | 'Generated with' : '基于',
12 | 'Name' : '名称',
13 | 'No response values.' : '无返回值.',
14 | 'optional' : '可选',
15 | 'Parameter' : '参数',
16 | 'Permission:' : '权限:',
17 | 'Response' : '返回',
18 | 'Send' : '发送',
19 | 'Send a Sample Request' : '发送示例请求',
20 | 'show up to version:' : '显示到指定版本:',
21 | 'Size range:' : '取值范围:',
22 | 'Type' : '类型',
23 | 'url' : '网址'
24 | }
25 | });
26 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/vendor/path-to-regexp/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com)
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/vendor/prettify/lang-Splus.js:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | Copyright (C) 2012 Jeffrey B. Arnold
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,null,'"'],["str",/^\'(?:[^\'\\]|\\[\s\S])*(?:\'|$)/,null,"'"]],[["com",/^#.*/],["kwd",/^(?:if|else|for|while|repeat|in|next|break|return|switch|function)(?![A-Za-z0-9_.])/],["lit",/^0[xX][a-fA-F0-9]+([pP][0-9]+)?[Li]?/],["lit",/^[+-]?([0-9]+(\.[0-9]+)?|\.[0-9]+)([eE][+-]?[0-9]+)?[Li]?/],["lit",/^(?:NULL|NA(?:_(?:integer|real|complex|character)_)?|Inf|TRUE|FALSE|NaN|\.\.(?:\.|[0-9]+))(?![A-Za-z0-9_.])/],
18 | ["pun",/^(?:<-|->>?|-|==|<=|>=|<|>|&&?|!=|\|\|?|\*|\+|\^|\/|!|%.*?%|=|~|\$|@|:{1,3}|[\[\](){};,?])/],["pln",/^(?:[A-Za-z]+[A-Za-z0-9_.]*|\.[a-zA-Z_][0-9a-zA-Z\._]*)(?![A-Za-z0-9_.])/],["str",/^`.+`/]]),["r","s","R","S","Splus"]);
19 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/vendor/prettify/lang-aea.js:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | Copyright (C) 2009 Onno Hommes.
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | PR.registerLangHandler(PR.createSimpleLexer([["com",/^#[^\r\n]*/,null,"#"],["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,null,'"']],[["kwd",/^(?:ADS|AD|AUG|BZF|BZMF|CAE|CAF|CA|CCS|COM|CS|DAS|DCA|DCOM|DCS|DDOUBL|DIM|DOUBLE|DTCB|DTCF|DV|DXCH|EDRUPT|EXTEND|INCR|INDEX|NDX|INHINT|LXCH|MASK|MSK|MP|MSU|NOOP|OVSK|QXCH|RAND|READ|RELINT|RESUME|RETURN|ROR|RXOR|SQUARE|SU|TCR|TCAA|OVSK|TCF|TC|TS|WAND|WOR|WRITE|XCH|XLQ|XXALQ|ZL|ZQ|ADD|ADZ|SUB|SUZ|MPY|MPR|MPZ|DVP|COM|ABS|CLA|CLZ|LDQ|STO|STQ|ALS|LLS|LRS|TRA|TSQ|TMI|TOV|AXT|TIX|DLY|INP|OUT)\s/,
18 | null],["typ",/^(?:-?GENADR|=MINUS|2BCADR|VN|BOF|MM|-?2CADR|-?[1-6]DNADR|ADRES|BBCON|[SE]?BANK\=?|BLOCK|BNKSUM|E?CADR|COUNT\*?|2?DEC\*?|-?DNCHAN|-?DNPTR|EQUALS|ERASE|MEMORY|2?OCT|REMADR|SETLOC|SUBRO|ORG|BSS|BES|SYN|EQU|DEFINE|END)\s/,null],["lit",/^\'(?:-*(?:\w|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?)?/],["pln",/^-*(?:[!-z_]|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?/i],["pun",/^[^\w\t\n\r \xA0()\"\\\';]+/]]),["apollo","agc","aea"]);
19 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/vendor/prettify/lang-agc.js:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | Copyright (C) 2009 Onno Hommes.
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | PR.registerLangHandler(PR.createSimpleLexer([["com",/^#[^\r\n]*/,null,"#"],["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,null,'"']],[["kwd",/^(?:ADS|AD|AUG|BZF|BZMF|CAE|CAF|CA|CCS|COM|CS|DAS|DCA|DCOM|DCS|DDOUBL|DIM|DOUBLE|DTCB|DTCF|DV|DXCH|EDRUPT|EXTEND|INCR|INDEX|NDX|INHINT|LXCH|MASK|MSK|MP|MSU|NOOP|OVSK|QXCH|RAND|READ|RELINT|RESUME|RETURN|ROR|RXOR|SQUARE|SU|TCR|TCAA|OVSK|TCF|TC|TS|WAND|WOR|WRITE|XCH|XLQ|XXALQ|ZL|ZQ|ADD|ADZ|SUB|SUZ|MPY|MPR|MPZ|DVP|COM|ABS|CLA|CLZ|LDQ|STO|STQ|ALS|LLS|LRS|TRA|TSQ|TMI|TOV|AXT|TIX|DLY|INP|OUT)\s/,
18 | null],["typ",/^(?:-?GENADR|=MINUS|2BCADR|VN|BOF|MM|-?2CADR|-?[1-6]DNADR|ADRES|BBCON|[SE]?BANK\=?|BLOCK|BNKSUM|E?CADR|COUNT\*?|2?DEC\*?|-?DNCHAN|-?DNPTR|EQUALS|ERASE|MEMORY|2?OCT|REMADR|SETLOC|SUBRO|ORG|BSS|BES|SYN|EQU|DEFINE|END)\s/,null],["lit",/^\'(?:-*(?:\w|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?)?/],["pln",/^-*(?:[!-z_]|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?/i],["pun",/^[^\w\t\n\r \xA0()\"\\\';]+/]]),["apollo","agc","aea"]);
19 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/vendor/prettify/lang-apollo.js:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | Copyright (C) 2009 Onno Hommes.
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | PR.registerLangHandler(PR.createSimpleLexer([["com",/^#[^\r\n]*/,null,"#"],["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,null,'"']],[["kwd",/^(?:ADS|AD|AUG|BZF|BZMF|CAE|CAF|CA|CCS|COM|CS|DAS|DCA|DCOM|DCS|DDOUBL|DIM|DOUBLE|DTCB|DTCF|DV|DXCH|EDRUPT|EXTEND|INCR|INDEX|NDX|INHINT|LXCH|MASK|MSK|MP|MSU|NOOP|OVSK|QXCH|RAND|READ|RELINT|RESUME|RETURN|ROR|RXOR|SQUARE|SU|TCR|TCAA|OVSK|TCF|TC|TS|WAND|WOR|WRITE|XCH|XLQ|XXALQ|ZL|ZQ|ADD|ADZ|SUB|SUZ|MPY|MPR|MPZ|DVP|COM|ABS|CLA|CLZ|LDQ|STO|STQ|ALS|LLS|LRS|TRA|TSQ|TMI|TOV|AXT|TIX|DLY|INP|OUT)\s/,
18 | null],["typ",/^(?:-?GENADR|=MINUS|2BCADR|VN|BOF|MM|-?2CADR|-?[1-6]DNADR|ADRES|BBCON|[SE]?BANK\=?|BLOCK|BNKSUM|E?CADR|COUNT\*?|2?DEC\*?|-?DNCHAN|-?DNPTR|EQUALS|ERASE|MEMORY|2?OCT|REMADR|SETLOC|SUBRO|ORG|BSS|BES|SYN|EQU|DEFINE|END)\s/,null],["lit",/^\'(?:-*(?:\w|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?)?/],["pln",/^-*(?:[!-z_]|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?/i],["pun",/^[^\w\t\n\r \xA0()\"\\\';]+/]]),["apollo","agc","aea"]);
19 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/vendor/prettify/lang-basic.js:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | Copyright (C) 2013 Peter Kofler
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | PR.registerLangHandler(PR.createSimpleLexer([["str",/^(?:"(?:[^\\"\r\n]|\\.)*(?:"|$))/,null,'"'],["pln",/^\s+/,null," \r\n\t\u00a0"]],[["com",/^REM[^\r\n]*/,null],["kwd",/^\b(?:AND|CLOSE|CLR|CMD|CONT|DATA|DEF ?FN|DIM|END|FOR|GET|GOSUB|GOTO|IF|INPUT|LET|LIST|LOAD|NEW|NEXT|NOT|ON|OPEN|OR|POKE|PRINT|READ|RESTORE|RETURN|RUN|SAVE|STEP|STOP|SYS|THEN|TO|VERIFY|WAIT)\b/,null],["pln",/^[A-Z][A-Z0-9]?(?:\$|%)?/i,null],["lit",/^(?:\d+(?:\.\d*)?|\.\d+)(?:e[+\-]?\d+)?/i,
18 | null,"0123456789"],["pun",/^.[^\s\w\.$%"]*/,null]]),["basic","cbm"]);
19 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/vendor/prettify/lang-cbm.js:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | Copyright (C) 2013 Peter Kofler
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | PR.registerLangHandler(PR.createSimpleLexer([["str",/^(?:"(?:[^\\"\r\n]|\\.)*(?:"|$))/,null,'"'],["pln",/^\s+/,null," \r\n\t\u00a0"]],[["com",/^REM[^\r\n]*/,null],["kwd",/^\b(?:AND|CLOSE|CLR|CMD|CONT|DATA|DEF ?FN|DIM|END|FOR|GET|GOSUB|GOTO|IF|INPUT|LET|LIST|LOAD|NEW|NEXT|NOT|ON|OPEN|OR|POKE|PRINT|READ|RESTORE|RETURN|RUN|SAVE|STEP|STOP|SYS|THEN|TO|VERIFY|WAIT)\b/,null],["pln",/^[A-Z][A-Z0-9]?(?:\$|%)?/i,null],["lit",/^(?:\d+(?:\.\d*)?|\.\d+)(?:e[+\-]?\d+)?/i,
18 | null,"0123456789"],["pun",/^.[^\s\w\.$%"]*/,null]]),["basic","cbm"]);
19 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/vendor/prettify/lang-cl.js:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | Copyright (C) 2008 Google Inc.
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | PR.registerLangHandler(PR.createSimpleLexer([["opn",/^\(+/,null,"("],["clo",/^\)+/,null,")"],["com",/^;[^\r\n]*/,null,";"],["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,null,'"']],[["kwd",/^(?:block|c[ad]+r|catch|con[ds]|def(?:ine|un)|do|eq|eql|equal|equalp|eval-when|flet|format|go|if|labels|lambda|let|load-time-value|locally|macrolet|multiple-value-call|nil|progn|progv|quote|require|return-from|setq|symbol-macrolet|t|tagbody|the|throw|unwind)\b/,
18 | null],["lit",/^[+\-]?(?:[0#]x[0-9a-f]+|\d+\/\d+|(?:\.\d+|\d+(?:\.\d*)?)(?:[ed][+\-]?\d+)?)/i],["lit",/^\'(?:-*(?:\w|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?)?/],["pln",/^-*(?:[a-z_]|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?/i],["pun",/^[^\w\t\n\r \xA0()\"\\\';]+/]]),"cl el lisp lsp scm ss rkt".split(" "));
19 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/vendor/prettify/lang-clj.js:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2011 Google Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | PR.registerLangHandler(PR.createSimpleLexer([["opn",/^[\(\{\[]+/,null,"([{"],["clo",/^[\)\}\]]+/,null,")]}"],["com",/^;[^\r\n]*/,null,";"],["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,null,'"']],[["kwd",/^(?:def|if|do|let|quote|var|fn|loop|recur|throw|try|monitor-enter|monitor-exit|defmacro|defn|defn-|macroexpand|macroexpand-1|for|doseq|dosync|dotimes|and|or|when|not|assert|doto|proxy|defstruct|first|rest|cons|defprotocol|deftype|defrecord|reify|defmulti|defmethod|meta|with-meta|ns|in-ns|create-ns|import|intern|refer|alias|namespace|resolve|ref|deref|refset|new|set!|memfn|to-array|into-array|aset|gen-class|reduce|map|filter|find|nil?|empty?|hash-map|hash-set|vec|vector|seq|flatten|reverse|assoc|dissoc|list|list?|disj|get|union|difference|intersection|extend|extend-type|extend-protocol|prn)\b/,
17 | null],["typ",/^:[0-9a-zA-Z\-]+/]]),["clj"]);
18 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/vendor/prettify/lang-css.js:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | Copyright (C) 2009 Google Inc.
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[["str",/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],["str",/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']+)\)/i],["kwd",/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],
18 | ["com",/^(?:\x3c!--|--\x3e)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#(?:[0-9a-f]{3}){1,2}\b/i],["pln",/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],["pun",/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^\)\"\']+/]]),["css-str"]);
19 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/vendor/prettify/lang-dart.js:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | Copyright (C) 2013 Google Inc.
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"]],[["com",/^#!(?:.*)/],["kwd",/^\b(?:import|library|part of|part|as|show|hide)\b/i],["com",/^\/\/(?:.*)/],["com",/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],["kwd",/^\b(?:class|interface)\b/i],["kwd",/^\b(?:assert|async|await|break|case|catch|continue|default|do|else|finally|for|if|in|is|new|return|super|switch|sync|this|throw|try|while)\b/i],["kwd",/^\b(?:abstract|const|extends|factory|final|get|implements|native|operator|set|static|typedef|var)\b/i],
18 | ["typ",/^\b(?:bool|double|Dynamic|int|num|Object|String|void)\b/i],["kwd",/^\b(?:false|null|true)\b/i],["str",/^r?[\']{3}[\s|\S]*?[^\\][\']{3}/],["str",/^r?[\"]{3}[\s|\S]*?[^\\][\"]{3}/],["str",/^r?\'(\'|(?:[^\n\r\f])*?[^\\]\')/],["str",/^r?\"(\"|(?:[^\n\r\f])*?[^\\]\")/],["typ",/^[A-Z]\w*/],["pln",/^[a-z_$][a-z0-9_]*/i],["pun",/^[~!%^&*+=|?:<>/-]/],["lit",/^\b0x[0-9a-f]+/i],["lit",/^\b\d+(?:\.\d*)?(?:e[+-]?\d+)?/i],["lit",
19 | /^\b\.\d+(?:e[+-]?\d+)?/i],["pun",/^[(){}\[\],.;]/]]),["dart"]);
20 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/vendor/prettify/lang-el.js:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | Copyright (C) 2008 Google Inc.
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | PR.registerLangHandler(PR.createSimpleLexer([["opn",/^\(+/,null,"("],["clo",/^\)+/,null,")"],["com",/^;[^\r\n]*/,null,";"],["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,null,'"']],[["kwd",/^(?:block|c[ad]+r|catch|con[ds]|def(?:ine|un)|do|eq|eql|equal|equalp|eval-when|flet|format|go|if|labels|lambda|let|load-time-value|locally|macrolet|multiple-value-call|nil|progn|progv|quote|require|return-from|setq|symbol-macrolet|t|tagbody|the|throw|unwind)\b/,
18 | null],["lit",/^[+\-]?(?:[0#]x[0-9a-f]+|\d+\/\d+|(?:\.\d+|\d+(?:\.\d*)?)(?:[ed][+\-]?\d+)?)/i],["lit",/^\'(?:-*(?:\w|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?)?/],["pln",/^-*(?:[a-z_]|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?/i],["pun",/^[^\w\t\n\r \xA0()\"\\\';]+/]]),"cl el lisp lsp scm ss rkt".split(" "));
19 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/vendor/prettify/lang-erl.js:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | Copyright (C) 2013 Andrew Allen
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\x0B\x0C\r ]+/,null,"\t\n\x0B\f\r "],["str",/^\"(?:[^\"\\\n\x0C\r]|\\[\s\S])*(?:\"|$)/,null,'"'],["lit",/^[a-z][a-zA-Z0-9_]*/],["lit",/^\'(?:[^\'\\\n\x0C\r]|\\[^&])+\'?/,null,"'"],["lit",/^\?[^ \t\n({]+/,null,"?"],["lit",/^(?:0o[0-7]+|0x[\da-f]+|\d+(?:\.\d+)?(?:e[+\-]?\d+)?)/i,null,"0123456789"]],[["com",/^%[^\n]*/],["kwd",/^(?:module|attributes|do|let|in|letrec|apply|call|primop|case|of|end|when|fun|try|catch|receive|after|char|integer|float,atom,string,var)\b/],
18 | ["kwd",/^-[a-z_]+/],["typ",/^[A-Z_][a-zA-Z0-9_]*/],["pun",/^[.,;]/]]),["erlang","erl"]);
19 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/vendor/prettify/lang-erlang.js:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | Copyright (C) 2013 Andrew Allen
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\x0B\x0C\r ]+/,null,"\t\n\x0B\f\r "],["str",/^\"(?:[^\"\\\n\x0C\r]|\\[\s\S])*(?:\"|$)/,null,'"'],["lit",/^[a-z][a-zA-Z0-9_]*/],["lit",/^\'(?:[^\'\\\n\x0C\r]|\\[^&])+\'?/,null,"'"],["lit",/^\?[^ \t\n({]+/,null,"?"],["lit",/^(?:0o[0-7]+|0x[\da-f]+|\d+(?:\.\d+)?(?:e[+\-]?\d+)?)/i,null,"0123456789"]],[["com",/^%[^\n]*/],["kwd",/^(?:module|attributes|do|let|in|letrec|apply|call|primop|case|of|end|when|fun|try|catch|receive|after|char|integer|float,atom,string,var)\b/],
18 | ["kwd",/^-[a-z_]+/],["typ",/^[A-Z_][a-zA-Z0-9_]*/],["pun",/^[.,;]/]]),["erlang","erl"]);
19 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/vendor/prettify/lang-go.js:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | Copyright (C) 2010 Google Inc.
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["pln",/^(?:\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)|\'(?:[^\'\\]|\\[\s\S])+(?:\'|$)|`[^`]*(?:`|$))/,null,"\"'"]],[["com",/^(?:\/\/[^\r\n]*|\/\*[\s\S]*?\*\/)/],["pln",/^(?:[^\/\"\'`]|\/(?![\/\*]))+/i]]),["go"]);
18 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/vendor/prettify/lang-hs.js:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | Copyright (C) 2009 Google Inc.
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\x0B\x0C\r ]+/,null,"\t\n\x0B\f\r "],["str",/^\"(?:[^\"\\\n\x0C\r]|\\[\s\S])*(?:\"|$)/,null,'"'],["str",/^\'(?:[^\'\\\n\x0C\r]|\\[^&])\'?/,null,"'"],["lit",/^(?:0o[0-7]+|0x[\da-f]+|\d+(?:\.\d+)?(?:e[+\-]?\d+)?)/i,null,"0123456789"]],[["com",/^(?:(?:--+(?:[^\r\n\x0C]*)?)|(?:\{-(?:[^-]|-+[^-\}])*-\}))/],["kwd",/^(?:case|class|data|default|deriving|do|else|if|import|in|infix|infixl|infixr|instance|let|module|newtype|of|then|type|where|_)(?=[^a-zA-Z0-9\']|$)/,
18 | null],["pln",/^(?:[A-Z][\w\']*\.)*[a-zA-Z][\w\']*/],["pun",/^[^\t\n\x0B\x0C\r a-zA-Z0-9\'\"]+/]]),["hs"]);
19 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/vendor/prettify/lang-latex.js:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | Copyright (C) 2011 Martin S.
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["com",/^%[^\r\n]*/,null,"%"]],[["kwd",/^\\[a-zA-Z@]+/],["kwd",/^\\./],["typ",/^[$&]/],["lit",/[+-]?(?:\.\d+|\d+(?:\.\d*)?)(cm|em|ex|in|pc|pt|bp|mm)/i],["pun",/^[{}()\[\]=]+/]]),["latex","tex"]);
18 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/vendor/prettify/lang-lgt.js:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | Copyright (C) 2014 Paulo Moura
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | PR.registerLangHandler(PR.createSimpleLexer([["str",/^\"(?:[^\"\\\n\x0C\r]|\\[\s\S])*(?:\"|$)/,null,'"'],["lit",/^[a-z][a-zA-Z0-9_]*/],["lit",/^\'(?:[^\'\\\n\x0C\r]|\\[^&])+\'?/,null,"'"],["lit",/^(?:0'.|0b[0-1]+|0o[0-7]+|0x[\da-f]+|\d+(?:\.\d+)?(?:e[+\-]?\d+)?)/i,null,"0123456789"]],[["com",/^%[^\r\n]*/,null,"%"],["com",/^\/\*[\s\S]*?\*\//],["kwd",/^\s*:-\s(c(a(lls|tegory)|oinductive)|p(ublic|r(ot(ocol|ected)|ivate))|e(l(if|se)|n(coding|sure_loaded)|xport)|i(f|n(clude|itialization|fo))|alias|d(ynamic|iscontiguous)|m(eta_(non_terminal|predicate)|od(e|ule)|ultifile)|reexport|s(et_(logtalk|prolog)_flag|ynchronized)|o(bject|p)|use(s|_module))/],
18 | ["kwd",/^\s*:-\s(e(lse|nd(if|_(category|object|protocol)))|built_in|dynamic|synchronized|threaded)/],["typ",/^[A-Z_][a-zA-Z0-9_]*/],["pun",/^[.,;{}:^<>=\\/+*?#!-]/]]),["logtalk","lgt"]);
19 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/vendor/prettify/lang-lisp.js:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | Copyright (C) 2008 Google Inc.
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | PR.registerLangHandler(PR.createSimpleLexer([["opn",/^\(+/,null,"("],["clo",/^\)+/,null,")"],["com",/^;[^\r\n]*/,null,";"],["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,null,'"']],[["kwd",/^(?:block|c[ad]+r|catch|con[ds]|def(?:ine|un)|do|eq|eql|equal|equalp|eval-when|flet|format|go|if|labels|lambda|let|load-time-value|locally|macrolet|multiple-value-call|nil|progn|progv|quote|require|return-from|setq|symbol-macrolet|t|tagbody|the|throw|unwind)\b/,
18 | null],["lit",/^[+\-]?(?:[0#]x[0-9a-f]+|\d+\/\d+|(?:\.\d+|\d+(?:\.\d*)?)(?:[ed][+\-]?\d+)?)/i],["lit",/^\'(?:-*(?:\w|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?)?/],["pln",/^-*(?:[a-z_]|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?/i],["pun",/^[^\w\t\n\r \xA0()\"\\\';]+/]]),"cl el lisp lsp scm ss rkt".split(" "));
19 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/vendor/prettify/lang-ll.js:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | Copyright (C) 2013 Nikhil Dabas
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^!?\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,null,'"'],["com",/^;[^\r\n]*/,null,";"]],[["pln",/^[%@!](?:[-a-zA-Z$._][-a-zA-Z$._0-9]*|\d+)/],["kwd",/^[A-Za-z_][0-9A-Za-z_]*/,null],["lit",/^\d+\.\d+/],["lit",/^(?:\d+|0[xX][a-fA-F0-9]+)/],["pun",/^[()\[\]{},=*<>:]|\.\.\.$/]]),["llvm","ll"]);
18 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/vendor/prettify/lang-llvm.js:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | Copyright (C) 2013 Nikhil Dabas
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^!?\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,null,'"'],["com",/^;[^\r\n]*/,null,";"]],[["pln",/^[%@!](?:[-a-zA-Z$._][-a-zA-Z$._0-9]*|\d+)/],["kwd",/^[A-Za-z_][0-9A-Za-z_]*/,null],["lit",/^\d+\.\d+/],["lit",/^(?:\d+|0[xX][a-fA-F0-9]+)/],["pun",/^[()\[\]{},=*<>:]|\.\.\.$/]]),["llvm","ll"]);
18 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/vendor/prettify/lang-logtalk.js:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | Copyright (C) 2014 Paulo Moura
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | PR.registerLangHandler(PR.createSimpleLexer([["str",/^\"(?:[^\"\\\n\x0C\r]|\\[\s\S])*(?:\"|$)/,null,'"'],["lit",/^[a-z][a-zA-Z0-9_]*/],["lit",/^\'(?:[^\'\\\n\x0C\r]|\\[^&])+\'?/,null,"'"],["lit",/^(?:0'.|0b[0-1]+|0o[0-7]+|0x[\da-f]+|\d+(?:\.\d+)?(?:e[+\-]?\d+)?)/i,null,"0123456789"]],[["com",/^%[^\r\n]*/,null,"%"],["com",/^\/\*[\s\S]*?\*\//],["kwd",/^\s*:-\s(c(a(lls|tegory)|oinductive)|p(ublic|r(ot(ocol|ected)|ivate))|e(l(if|se)|n(coding|sure_loaded)|xport)|i(f|n(clude|itialization|fo))|alias|d(ynamic|iscontiguous)|m(eta_(non_terminal|predicate)|od(e|ule)|ultifile)|reexport|s(et_(logtalk|prolog)_flag|ynchronized)|o(bject|p)|use(s|_module))/],
18 | ["kwd",/^\s*:-\s(e(lse|nd(if|_(category|object|protocol)))|built_in|dynamic|synchronized|threaded)/],["typ",/^[A-Z_][a-zA-Z0-9_]*/],["pun",/^[.,;{}:^<>=\\/+*?#!-]/]]),["logtalk","lgt"]);
19 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/vendor/prettify/lang-lsp.js:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | Copyright (C) 2008 Google Inc.
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | PR.registerLangHandler(PR.createSimpleLexer([["opn",/^\(+/,null,"("],["clo",/^\)+/,null,")"],["com",/^;[^\r\n]*/,null,";"],["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,null,'"']],[["kwd",/^(?:block|c[ad]+r|catch|con[ds]|def(?:ine|un)|do|eq|eql|equal|equalp|eval-when|flet|format|go|if|labels|lambda|let|load-time-value|locally|macrolet|multiple-value-call|nil|progn|progv|quote|require|return-from|setq|symbol-macrolet|t|tagbody|the|throw|unwind)\b/,
18 | null],["lit",/^[+\-]?(?:[0#]x[0-9a-f]+|\d+\/\d+|(?:\.\d+|\d+(?:\.\d*)?)(?:[ed][+\-]?\d+)?)/i],["lit",/^\'(?:-*(?:\w|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?)?/],["pln",/^-*(?:[a-z_]|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?/i],["pun",/^[^\w\t\n\r \xA0()\"\\\';]+/]]),"cl el lisp lsp scm ss rkt".split(" "));
19 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/vendor/prettify/lang-lua.js:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | Copyright (C) 2008 Google Inc.
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^(?:\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)|\'(?:[^\'\\]|\\[\s\S])*(?:\'|$))/,null,"\"'"]],[["com",/^--(?:\[(=*)\[[\s\S]*?(?:\]\1\]|$)|[^\r\n]*)/],["str",/^\[(=*)\[[\s\S]*?(?:\]\1\]|$)/],["kwd",/^(?:and|break|do|else|elseif|end|false|for|function|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/,null],["lit",/^[+-]?(?:0x[\da-f]+|(?:(?:\.\d+|\d+(?:\.\d*)?)(?:e[+\-]?\d+)?))/i],
18 | ["pln",/^[a-z_]\w*/i],["pun",/^[^\w\t\n\r \xA0][^\w\t\n\r \xA0\"\'\-\+=]*/]]),["lua"]);
19 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/vendor/prettify/lang-mumps.js:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | Copyright (C) 2011 Kitware Inc.
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^(?:"(?:[^"]|\\.)*")/,null,'"']],[["com",/^;[^\r\n]*/,null,";"],["dec",/^(?:\$(?:D|DEVICE|EC|ECODE|ES|ESTACK|ET|ETRAP|H|HOROLOG|I|IO|J|JOB|K|KEY|P|PRINCIPAL|Q|QUIT|ST|STACK|S|STORAGE|SY|SYSTEM|T|TEST|TL|TLEVEL|TR|TRESTART|X|Y|Z[A-Z]*|A|ASCII|C|CHAR|D|DATA|E|EXTRACT|F|FIND|FN|FNUMBER|G|GET|J|JUSTIFY|L|LENGTH|NA|NAME|O|ORDER|P|PIECE|QL|QLENGTH|QS|QSUBSCRIPT|Q|QUERY|R|RANDOM|RE|REVERSE|S|SELECT|ST|STACK|T|TEXT|TR|TRANSLATE|NaN))\b/i,
18 | null],["kwd",/^(?:[^\$]B|BREAK|C|CLOSE|D|DO|E|ELSE|F|FOR|G|GOTO|H|HALT|H|HANG|I|IF|J|JOB|K|KILL|L|LOCK|M|MERGE|N|NEW|O|OPEN|Q|QUIT|R|READ|S|SET|TC|TCOMMIT|TRE|TRESTART|TRO|TROLLBACK|TS|TSTART|U|USE|V|VIEW|W|WRITE|X|XECUTE)\b/i,null],["lit",/^[+-]?(?:(?:\.\d+|\d+(?:\.\d*)?)(?:E[+\-]?\d+)?)/i],["pln",/^[a-z][a-zA-Z0-9]*/i],["pun",/^[^\w\t\n\r\xA0\"\$;%\^]|_/]]),["mumps"]);
19 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/vendor/prettify/lang-pascal.js:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | Copyright (C) 2013 Peter Kofler
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | PR.registerLangHandler(PR.createSimpleLexer([["str",/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$))/,null,"'"],["pln",/^\s+/,null," \r\n\t\u00a0"]],[["com",/^\(\*[\s\S]*?(?:\*\)|$)|^\{[\s\S]*?(?:\}|$)/,null],["kwd",/^(?:ABSOLUTE|AND|ARRAY|ASM|ASSEMBLER|BEGIN|CASE|CONST|CONSTRUCTOR|DESTRUCTOR|DIV|DO|DOWNTO|ELSE|END|EXTERNAL|FOR|FORWARD|FUNCTION|GOTO|IF|IMPLEMENTATION|IN|INLINE|INTERFACE|INTERRUPT|LABEL|MOD|NOT|OBJECT|OF|OR|PACKED|PROCEDURE|PROGRAM|RECORD|REPEAT|SET|SHL|SHR|THEN|TO|TYPE|UNIT|UNTIL|USES|VAR|VIRTUAL|WHILE|WITH|XOR)\b/i,
18 | null],["lit",/^(?:true|false|self|nil)/i,null],["pln",/^[a-z][a-z0-9]*/i,null],["lit",/^(?:\$[a-f0-9]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+\-]?\d+)?)/i,null,"0123456789"],["pun",/^.[^\s\w\.$@\'\/]*/,null]]),["pascal"]);
19 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/vendor/prettify/lang-proto.js:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | Copyright (C) 2006 Google Inc.
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | PR.registerLangHandler(PR.sourceDecorator({keywords:"bytes,default,double,enum,extend,extensions,false,group,import,max,message,option,optional,package,repeated,required,returns,rpc,service,syntax,to,true",types:/^(bool|(double|s?fixed|[su]?int)(32|64)|float|string)\b/,cStyleComments:!0}),["proto"]);
18 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/vendor/prettify/lang-r.js:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | Copyright (C) 2012 Jeffrey B. Arnold
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,null,'"'],["str",/^\'(?:[^\'\\]|\\[\s\S])*(?:\'|$)/,null,"'"]],[["com",/^#.*/],["kwd",/^(?:if|else|for|while|repeat|in|next|break|return|switch|function)(?![A-Za-z0-9_.])/],["lit",/^0[xX][a-fA-F0-9]+([pP][0-9]+)?[Li]?/],["lit",/^[+-]?([0-9]+(\.[0-9]+)?|\.[0-9]+)([eE][+-]?[0-9]+)?[Li]?/],["lit",/^(?:NULL|NA(?:_(?:integer|real|complex|character)_)?|Inf|TRUE|FALSE|NaN|\.\.(?:\.|[0-9]+))(?![A-Za-z0-9_.])/],
18 | ["pun",/^(?:<-|->>?|-|==|<=|>=|<|>|&&?|!=|\|\|?|\*|\+|\^|\/|!|%.*?%|=|~|\$|@|:{1,3}|[\[\](){};,?])/],["pln",/^(?:[A-Za-z]+[A-Za-z0-9_.]*|\.[a-zA-Z_][0-9a-zA-Z\._]*)(?![A-Za-z0-9_.])/],["str",/^`.+`/]]),["r","s","R","S","Splus"]);
19 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/vendor/prettify/lang-rd.js:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | Copyright (C) 2012 Jeffrey Arnold
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["com",/^%[^\r\n]*/,null,"%"]],[["lit",/^\\(?:cr|l?dots|R|tab)\b/],["kwd",/^\\[a-zA-Z@]+/],["kwd",/^#(?:ifn?def|endif)/],["pln",/^\\[{}]/],["pun",/^[{}()\[\]]+/]]),["Rd","rd"]);
18 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/vendor/prettify/lang-rkt.js:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | Copyright (C) 2008 Google Inc.
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | PR.registerLangHandler(PR.createSimpleLexer([["opn",/^\(+/,null,"("],["clo",/^\)+/,null,")"],["com",/^;[^\r\n]*/,null,";"],["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,null,'"']],[["kwd",/^(?:block|c[ad]+r|catch|con[ds]|def(?:ine|un)|do|eq|eql|equal|equalp|eval-when|flet|format|go|if|labels|lambda|let|load-time-value|locally|macrolet|multiple-value-call|nil|progn|progv|quote|require|return-from|setq|symbol-macrolet|t|tagbody|the|throw|unwind)\b/,
18 | null],["lit",/^[+\-]?(?:[0#]x[0-9a-f]+|\d+\/\d+|(?:\.\d+|\d+(?:\.\d*)?)(?:[ed][+\-]?\d+)?)/i],["lit",/^\'(?:-*(?:\w|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?)?/],["pln",/^-*(?:[a-z_]|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?/i],["pun",/^[^\w\t\n\r \xA0()\"\\\';]+/]]),"cl el lisp lsp scm ss rkt".split(" "));
19 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/vendor/prettify/lang-s.js:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | Copyright (C) 2012 Jeffrey B. Arnold
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,null,'"'],["str",/^\'(?:[^\'\\]|\\[\s\S])*(?:\'|$)/,null,"'"]],[["com",/^#.*/],["kwd",/^(?:if|else|for|while|repeat|in|next|break|return|switch|function)(?![A-Za-z0-9_.])/],["lit",/^0[xX][a-fA-F0-9]+([pP][0-9]+)?[Li]?/],["lit",/^[+-]?([0-9]+(\.[0-9]+)?|\.[0-9]+)([eE][+-]?[0-9]+)?[Li]?/],["lit",/^(?:NULL|NA(?:_(?:integer|real|complex|character)_)?|Inf|TRUE|FALSE|NaN|\.\.(?:\.|[0-9]+))(?![A-Za-z0-9_.])/],
18 | ["pun",/^(?:<-|->>?|-|==|<=|>=|<|>|&&?|!=|\|\|?|\*|\+|\^|\/|!|%.*?%|=|~|\$|@|:{1,3}|[\[\](){};,?])/],["pln",/^(?:[A-Za-z]+[A-Za-z0-9_.]*|\.[a-zA-Z_][0-9a-zA-Z\._]*)(?![A-Za-z0-9_.])/],["str",/^`.+`/]]),["r","s","R","S","Splus"]);
19 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/vendor/prettify/lang-scala.js:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | Copyright (C) 2010 Google Inc.
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^(?:"(?:(?:""(?:""?(?!")|[^\\"]|\\.)*"{0,3})|(?:[^"\r\n\\]|\\.)*"?))/,null,'"'],["lit",/^`(?:[^\r\n\\`]|\\.)*`?/,null,"`"],["pun",/^[!#%&()*+,\-:;<=>?@\[\\\]^{|}~]+/,null,"!#%&()*+,-:;<=>?@[\\]^{|}~"]],[["str",/^'(?:[^\r\n\\']|\\(?:'|[^\r\n']+))'/],["lit",/^'[a-zA-Z_$][\w$]*(?!['$\w])/],["kwd",/^(?:abstract|case|catch|class|def|do|else|extends|final|finally|for|forSome|if|implicit|import|lazy|match|new|object|override|package|private|protected|requires|return|sealed|super|throw|trait|try|type|val|var|while|with|yield)\b/],
18 | ["lit",/^(?:true|false|null|this)\b/],["lit",/^(?:(?:0(?:[0-7]+|X[0-9A-F]+))L?|(?:(?:0|[1-9][0-9]*)(?:(?:\.[0-9]+)?(?:E[+\-]?[0-9]+)?F?|L?))|\\.[0-9]+(?:E[+\-]?[0-9]+)?F?)/i],["typ",/^[$_]*[A-Z][_$A-Z0-9]*[a-z][\w$]*/],["pln",/^[$a-zA-Z_][\w$]*/],["com",/^\/(?:\/.*|\*(?:\/|\**[^*/])*(?:\*+\/?)?)/],["pun",/^(?:\.+|\/)/]]),["scala"]);
19 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/vendor/prettify/lang-scm.js:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | Copyright (C) 2008 Google Inc.
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | PR.registerLangHandler(PR.createSimpleLexer([["opn",/^\(+/,null,"("],["clo",/^\)+/,null,")"],["com",/^;[^\r\n]*/,null,";"],["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,null,'"']],[["kwd",/^(?:block|c[ad]+r|catch|con[ds]|def(?:ine|un)|do|eq|eql|equal|equalp|eval-when|flet|format|go|if|labels|lambda|let|load-time-value|locally|macrolet|multiple-value-call|nil|progn|progv|quote|require|return-from|setq|symbol-macrolet|t|tagbody|the|throw|unwind)\b/,
18 | null],["lit",/^[+\-]?(?:[0#]x[0-9a-f]+|\d+\/\d+|(?:\.\d+|\d+(?:\.\d*)?)(?:[ed][+\-]?\d+)?)/i],["lit",/^\'(?:-*(?:\w|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?)?/],["pln",/^-*(?:[a-z_]|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?/i],["pun",/^[^\w\t\n\r \xA0()\"\\\';]+/]]),"cl el lisp lsp scm ss rkt".split(" "));
19 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/vendor/prettify/lang-ss.js:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | Copyright (C) 2008 Google Inc.
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | PR.registerLangHandler(PR.createSimpleLexer([["opn",/^\(+/,null,"("],["clo",/^\)+/,null,")"],["com",/^;[^\r\n]*/,null,";"],["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,null,'"']],[["kwd",/^(?:block|c[ad]+r|catch|con[ds]|def(?:ine|un)|do|eq|eql|equal|equalp|eval-when|flet|format|go|if|labels|lambda|let|load-time-value|locally|macrolet|multiple-value-call|nil|progn|progv|quote|require|return-from|setq|symbol-macrolet|t|tagbody|the|throw|unwind)\b/,
18 | null],["lit",/^[+\-]?(?:[0#]x[0-9a-f]+|\d+\/\d+|(?:\.\d+|\d+(?:\.\d*)?)(?:[ed][+\-]?\d+)?)/i],["lit",/^\'(?:-*(?:\w|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?)?/],["pln",/^-*(?:[a-z_]|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?/i],["pun",/^[^\w\t\n\r \xA0()\"\\\';]+/]]),"cl el lisp lsp scm ss rkt".split(" "));
19 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/vendor/prettify/lang-tcl.js:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | Copyright (C) 2012 Pyrios
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | PR.registerLangHandler(PR.createSimpleLexer([["opn",/^\{+/,null,"{"],["clo",/^\}+/,null,"}"],["com",/^#[^\r\n]*/,null,"#"],["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,null,'"']],[["kwd",/^(?:after|append|apply|array|break|case|catch|continue|error|eval|exec|exit|expr|for|foreach|if|incr|info|proc|return|set|switch|trace|uplevel|upvar|while)\b/,null],["lit",/^[+\-]?(?:[0#]x[0-9a-f]+|\d+\/\d+|(?:\.\d+|\d+(?:\.\d*)?)(?:[ed][+\-]?\d+)?)/i],
18 | ["lit",/^\'(?:-*(?:\w|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?)?/],["pln",/^-*(?:[a-z_]|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?/i],["pun",/^[^\w\t\n\r \xA0()\"\\\';]+/]]),["tcl"]);
19 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/vendor/prettify/lang-tex.js:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | Copyright (C) 2011 Martin S.
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["com",/^%[^\r\n]*/,null,"%"]],[["kwd",/^\\[a-zA-Z@]+/],["kwd",/^\\./],["typ",/^[$&]/],["lit",/[+-]?(?:\.\d+|\d+(?:\.\d*)?)(cm|em|ex|in|pc|pt|bp|mm)/i],["pun",/^[{}()\[\]=]+/]]),["latex","tex"]);
18 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/vendor/prettify/lang-wiki.js:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | Copyright (C) 2009 Google Inc.
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t \xA0a-gi-z0-9]+/,null,"\t \u00a0abcdefgijklmnopqrstuvwxyz0123456789"],["pun",/^[=*~\^\[\]]+/,null,"=*~^[]"]],[["lang-wiki.meta",/(?:^^|\r\n?|\n)(#[a-z]+)\b/],["lit",/^(?:[A-Z][a-z][a-z0-9]+[A-Z][a-z][a-zA-Z0-9]+)\b/],["lang-",/^\{\{\{([\s\S]+?)\}\}\}/],["lang-",/^`([^\r\n`]+)`/],["str",/^https?:\/\/[^\/?#\s]*(?:\/[^?#\s]*)?(?:\?[^#\s]*)?(?:#\S*)?/i],["pln",/^(?:\r\n|[\s\S])[^#=*~^A-Zh\{`\[\r\n]*/]]),["wiki"]);
18 | PR.registerLangHandler(PR.createSimpleLexer([["kwd",/^#[a-z]+/i,null,"#"]],[]),["wiki.meta"]);
19 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/vendor/prettify/lang-yaml.js:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | Copyright (C) 2015 ribrdb @ code.google.com
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | PR.registerLangHandler(PR.createSimpleLexer([["pun",/^[:|>?]+/,null,":|>?"],["dec",/^%(?:YAML|TAG)[^#\r\n]+/,null,"%"],["typ",/^[&]\S+/,null,"&"],["typ",/^!\S*/,null,"!"],["str",/^"(?:[^\\"]|\\.)*(?:"|$)/,null,'"'],["str",/^'(?:[^']|'')*(?:'|$)/,null,"'"],["com",/^#[^\r\n]*/,null,"#"],["pln",/^\s+/,null," \t\r\n"]],[["dec",/^(?:---|\.\.\.)(?:[\r\n]|$)/],["pun",/^-/],["kwd",/^[\w-]+:[ \r\n]/],["pln",
18 | /^\w+/]]),["yaml","yml"]);
19 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/vendor/prettify/lang-yml.js:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | Copyright (C) 2015 ribrdb @ code.google.com
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | PR.registerLangHandler(PR.createSimpleLexer([["pun",/^[:|>?]+/,null,":|>?"],["dec",/^%(?:YAML|TAG)[^#\r\n]+/,null,"%"],["typ",/^[&]\S+/,null,"&"],["typ",/^!\S*/,null,"!"],["str",/^"(?:[^\\"]|\\.)*(?:"|$)/,null,'"'],["str",/^'(?:[^']|'')*(?:'|$)/,null,"'"],["com",/^#[^\r\n]*/,null,"#"],["pln",/^\s+/,null," \t\r\n"]],[["dec",/^(?:---|\.\.\.)(?:[\r\n]|$)/],["pun",/^-/],["kwd",/^[\w-]+:[ \r\n]/],["pln",
18 | /^\w+/]]),["yaml","yml"]);
19 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/apidoc/vendor/prettify/prettify.css:
--------------------------------------------------------------------------------
1 | .pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/config/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "development": {
3 | "username": "root",
4 | "password": "admin",
5 | "database": "nodebird",
6 | "host": "127.0.0.1",
7 | "dialect": "mysql"
8 | },
9 | "test": {
10 | "username": "root",
11 | "password": null,
12 | "database": "database_test",
13 | "host": "127.0.0.1",
14 | "dialect": "mysql"
15 | },
16 | "production": {
17 | "username": "root",
18 | "password": null,
19 | "database": "database_production",
20 | "host": "127.0.0.1",
21 | "dialect": "mysql"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/models/domain.js:
--------------------------------------------------------------------------------
1 | module.exports = (sequelize, DataTypes) => (
2 | sequelize.define('domain', {
3 | host: {
4 | type: DataTypes.STRING(80),
5 | allowNull: false,
6 | },
7 | type: {
8 | type: DataTypes.STRING(10),
9 | allowNull: false,
10 | },
11 | clientSecret: {
12 | type: DataTypes.STRING(40),
13 | allowNull: false,
14 | }
15 | }, {
16 | validate: {
17 | unKnownType() {
18 | console.log(this.type, this.type !== 'free', this.type !== 'premium');
19 | if (this.type !== 'free' && this.type !== 'premium') {
20 | throw new Error('type 컬럼은 free나 premium이어야 합니다!');
21 | }
22 | },
23 | },
24 | timestamps: true,
25 | paranoid: true,
26 | })
27 | );
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/models/hashtag.js:
--------------------------------------------------------------------------------
1 | module.exports = (sequelize, DataTypes) => (
2 | sequelize.define('hastag', {
3 | title: {
4 | type: DataTypes.STRING(15),
5 | allowNull: false,
6 | unique: true,
7 | },
8 | }, {
9 | timestamps: true,
10 | paranoid: true,
11 | })
12 | );
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/models/index.js:
--------------------------------------------------------------------------------
1 | const Sequelize = require("sequelize");
2 | const env = process.env.NODE_ENV || "development";
3 | const config = require("../config/config")[env];
4 | const db = {};
5 |
6 | const sequelize = new Sequelize(
7 | config.database,
8 | config.username,
9 | config.password,
10 | config
11 | );
12 |
13 | db.sequelize = sequelize;
14 | db.Sequelize = Sequelize;
15 |
16 | db.User = require("./user")(sequelize, Sequelize);
17 | db.Post = require("./post")(sequelize, Sequelize);
18 | db.Hashtag = require("./hashtag")(sequelize, Sequelize);
19 | db.Domain = require("./domain")(sequelize, Sequelize);
20 |
21 | db.User.hasMany(db.Post);
22 | db.Post.belongsTo(db.User);
23 | db.Post.belongsToMany(db.Hashtag, { through: "PostHashtag" });
24 | db.Hashtag.belongsToMany(db.Post, { through: "PostHashtag" });
25 | db.User.belongsToMany(db.User, {
26 | foreignKey: "followingId",
27 | as: "Followers",
28 | through: "Follow"
29 | });
30 | db.User.belongsToMany(db.User, {
31 | foreignKey: "followerId",
32 | as: "Followings",
33 | through: "Follow"
34 | });
35 | db.User.hasMany(db.Domain);
36 | db.Domain.belongsTo(db.User);
37 |
38 | module.exports = db;
39 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/models/post.js:
--------------------------------------------------------------------------------
1 | module.exports = (sequelize, DataTypes) => (
2 | sequelize.define('post', {
3 | content: {
4 | type: DataTypes.STRING(140),
5 | allowNull: false,
6 | },
7 | img: {
8 | type: DataTypes.STRING(200),
9 | allowNull: true,
10 | },
11 | }, {
12 | timestamps: true,
13 | paranoid: true,
14 | })
15 | );
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/models/user.js:
--------------------------------------------------------------------------------
1 | module.exports = (sequelize, DataTypes) => (
2 | sequelize.define('user', {
3 | email: {
4 | type: DataTypes.STRING(40),
5 | allowNull: false,
6 | uniqeu: true,
7 | },
8 | nick: {
9 | type: DataTypes.STRING(15),
10 | allowNull: false,
11 | },
12 | password: {
13 | type: DataTypes.STRING(100),
14 | allowNull: true,
15 | },
16 | provider: {
17 | type: DataTypes.STRING(10),
18 | allowNull: false,
19 | defaultValue: 'local',
20 | },
21 | snsId: {
22 | type: DataTypes.STRING(30),
23 | allowNull: true,
24 | },
25 | }, {
26 | timestamps: true,
27 | paranoid: true,
28 | })
29 | );
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "nodebird-api",
3 | "version": "0.0.1",
4 | "description": "NodeBird API 서버",
5 | "main": "app.js",
6 | "scripts": {
7 | "start": "nodemon app",
8 | "test": "echo \"Error: no test specified\" && exit 1"
9 | },
10 | "author": "Junu",
11 | "license": "ISC",
12 | "dependencies": {
13 | "bcrypt": "^2.0.1",
14 | "connect-flash": "^0.1.1",
15 | "cookie-parser": "^1.4.3",
16 | "cors": "^2.8.5",
17 | "dotenv": "^5.0.1",
18 | "express": "^4.16.2",
19 | "express-rate-limit": "^3.3.2",
20 | "express-session": "^1.15.6",
21 | "jsonwebtoken": "^8.4.0",
22 | "morgan": "^1.9.0",
23 | "mysql2": "^1.5.1",
24 | "passport": "^0.4.0",
25 | "passport-kakao": "0.0.5",
26 | "passport-local": "^1.0.0",
27 | "pug": "^2.0.1",
28 | "sequelize": "^4.31.2",
29 | "uuid": "^3.1.0"
30 | },
31 | "devDependencies": {
32 | "nodemon": "^1.14.11"
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/passport/index.js:
--------------------------------------------------------------------------------
1 | const local = require('./localStrategy');
2 | const kakao = require('./kakaoStrategy');
3 | const { User } = require('../models');
4 |
5 | module.exports = (passport) => {
6 | passport.serializeUser((user, done) => {
7 | done(null, user.id); // done('에러 발생 시', '세션에 등록할 데이터');
8 | });
9 |
10 | passport.deserializeUser((id, done) => {
11 | User.find({
12 | where: { id },
13 | include: [{
14 | model: User,
15 | attributes: ['id', 'nick'],
16 | as: 'Followers',
17 | }, {
18 | model: User,
19 | attributes: ['id', 'nick'],
20 | as: 'Followings',
21 | }],
22 | })
23 | .then(user => done(null, user))
24 | .catch(err => done(err));
25 | });
26 |
27 | local(passport);
28 | kakao(passport);
29 | }
30 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/passport/kakaoStrategy.js:
--------------------------------------------------------------------------------
1 | const KakaoStrategy = require('passport-kakao').Strategy;
2 |
3 | const { User } = require('../models');
4 |
5 | module.exports = (passport) => {
6 | passport.use(new KakaoStrategy({
7 | clientID: process.env.KAKAO_ID,
8 | callbackURL: '/auth/kakao/callback',
9 | }, async (accessToken, refreshToken, profile, done) => {
10 | try {
11 | const exUser = await User.find({ where: { snsId: profile.id, provider: 'kakao' } });
12 | if (exUser) {
13 | done(null, exUser);
14 | } else {
15 | const newUser = await User.create({
16 | email: profile._json && profile._json.kaccount_email,
17 | nick: profile.displayName,
18 | snsId: profile.id,
19 | provider: 'kakao',
20 | });
21 | done(null, newUser);
22 | }
23 | } catch (error) {
24 | console.error(error);
25 | done(error);
26 | }
27 | }));
28 | };
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/passport/localStrategy.js:
--------------------------------------------------------------------------------
1 | const LocalStrategy = require('passport-local').Strategy;
2 | const bcrypt = require('bcrypt');
3 |
4 | const { User } = require('../models');
5 |
6 | module.exports = (passport) => {
7 | passport.use(new LocalStrategy({
8 | usernameField: 'email',
9 | passwordField: 'password',
10 | }, async (email, password, done) => {
11 | try {
12 | const exUser = await User.find({ where: { email }});
13 | if (exUser) {
14 | const result = await bcrypt.compare(password, exUser.password);
15 | if (result) {
16 | done(null, exUser);
17 | } else {
18 | done(null, false, { message: '비밀번호가 일치하지 않습니다.' });
19 | }
20 | } else {
21 | done(null, false, { message: '가입되지 않은 회원입니다.' });
22 | }
23 | } catch (error) {
24 | console.error(error);
25 | done(error);
26 | }
27 | }));
28 | };
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/routes/index.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const uuid4 = require('uuid/v4');
3 | const { User, Domain } = require('../models');
4 |
5 | const router = express.Router();
6 |
7 | router.get('/', async (req, res, next) => {
8 | try {
9 | const user = await User.find({ where: { id: req.user && req.user.id }, include: { model: Domain } });
10 | res.render('login', {
11 | user,
12 | loginError: req.flash('loginError'),
13 | domains: user && user.domains,
14 | });
15 | } catch (error) {
16 | console.error(error);
17 | next(error);
18 | }
19 | });
20 |
21 | router.post('/domain', async (req, res, next) => {
22 | try {
23 | await Domain.create({
24 | userId: req.user.id,
25 | host: req.body.host,
26 | type: req.body.type,
27 | clientSecret: uuid4(),
28 | });
29 | res.redirect('/');
30 | } catch (error) {
31 | console.error(error);
32 | next(error);
33 | }
34 | });
35 |
36 | module.exports = router;
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/routes/middlewares.js:
--------------------------------------------------------------------------------
1 | const jwt = require('jsonwebtoken');
2 | const RateLimit = require('express-rate-limit');
3 |
4 | exports.isLoggedIn = (req, res, next) => {
5 | if (req.isAuthenticated()) {
6 | next();
7 | } else {
8 | res.status(403).send("로그인 필요");
9 | }
10 | };
11 |
12 | exports.isNotLoggedIn = (req, res, next) => {
13 | if (!req.isAuthenticated()) {
14 | next();
15 | } else {
16 | res.redirect("/");
17 | }
18 | };
19 |
20 | exports.verifyToken = (req, res, next) => {
21 | try {
22 | req.decoded = jwt.verify(req.headers.authorization, process.env.JWT_SECRET);
23 | return next();
24 | } catch (error) {
25 | if (error.name === 'TokenExpiredError') { // 유효기간 초과
26 | return res.status(419).json({
27 | code: 419,
28 | message: '토큰이 만료되었습니다.',
29 | });
30 | }
31 | return res.status(401).json({
32 | code: 401,
33 | message: '유효하지 않은 토큰 입니다.',
34 | });
35 | }
36 | };
37 |
38 | exports.apiLimiter = new RateLimit({
39 | windowMs: 1000 * 3, // 기준시간
40 | max: 1, // 허용 횟수
41 | delayMs: 0, // 호출 간격
42 | handler(req, res) { // 제한 초과 시 콜백 함수
43 | res.status(this.statusCode).json({
44 | code: this.statusCode, // 기본값 429
45 | message: '3초에 한 번만 요청할 수 있습니다.',
46 | });
47 | },
48 | });
49 |
50 | exports.deprecated = (req, res) => {
51 | res.status(410).json({
52 | code: 410,
53 | message: '새로운 버전이 나왔습니다. 새로운 버전을 사용하세요.',
54 | });
55 | };
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/views/error.pug:
--------------------------------------------------------------------------------
1 | h1= message
2 | h2= error.status
3 | pre #{error.stack}
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-api/views/login.pug:
--------------------------------------------------------------------------------
1 | doctype
2 | html
3 | head
4 | meta(charset='utf-8')
5 | title NodeBird 로그인
6 | style.
7 | .input-group label {
8 | width: 200px;
9 | display: inline-block;
10 | }
11 | body
12 | if user && user.id
13 | span.user-name= '안녕하세요! ' + user.nick + '님'
14 | a(href='/auth/logout'): button 로그아웃
15 | fieldset
16 | legend 도메인 등록
17 | form(action='/domain' method='post')
18 | div
19 | label(for='type-free') 무료
20 | input#type-free(type='radio' name='type' value='free')
21 | label(for='type-premium') 프리미엄
22 | input#type-premium(type='radio' name='type' value='premium')
23 | div
24 | label(for='host') 도메인
25 | input#host(name='host' placeholder="ex) zerocho.com")
26 | button 저장
27 | table
28 | tr
29 | th 도메인 주소
30 | th 타입
31 | th 클라이언트 비밀키
32 | for domain in user.domains
33 | tr
34 | td= domain.host
35 | td= domain.type
36 | td= domain.clientSecret
37 |
38 | else
39 | form#login-form(action='/auth/login' method='post')
40 | h2 NodeBird 계정으로 로그인하세요.
41 | .input-group
42 | label(for='email') 이메일
43 | input#email(type='email' name='email' required autofocus)
44 | .input-group
45 | label(for='password') 비밀번호
46 | input#password(type='password' name='password' required)
47 | if loginError
48 | .error-message= loginError
49 | a(href='/join'): button#join(type='button') 회원가입
50 | button#login(type='submit') 로그인
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-call/.env:
--------------------------------------------------------------------------------
1 | COOKIE_SECRET=nodebirdcall
2 | CLIENT_SECRET=320cd434-6eb9-4a8f-99d7-d2bcd37ecb17
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-call/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-call/app.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const path = require('path');
3 | const morgan = require('morgan');
4 | const cookieParser = require('cookie-parser');
5 | const session = require('express-session');
6 | require('dotenv').config();
7 |
8 | const indexRouter = require('./routes');
9 |
10 | const app = express();
11 |
12 | app.set('views', path.join(__dirname, 'views'));
13 | app.set('view engine', 'pug');
14 | app.set('port', process.env.PORT || 8003);
15 |
16 | app.use(morgan('dev'));
17 | app.use(cookieParser(process.env.COOKIE_SECRET));
18 | app.use(session({
19 | resave: false,
20 | saveUninitialized: false,
21 | secret: process.env.COOKIE_SECRET,
22 | cookie: {
23 | httpOnly: true,
24 | secure: false,
25 | },
26 | }));
27 |
28 | app.use('/', indexRouter);
29 |
30 | app.use((req, res, next) => {
31 | const err = new Error('Not Found');
32 | err.status = 404;
33 | next(err);
34 | });
35 |
36 | app.use((err, req, res) => {
37 | res.locals.message = err.message,
38 | res.locals.error = req.app.get('env') === 'development' ? err : {};
39 | res.status(err.status || 500);
40 | res.render('error');
41 | });
42 |
43 | app.listen(app.get('port'), () => {
44 | console.log(app.get('port'), '번 포트에서 대기 중');
45 | });
46 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-call/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "nodebird-call",
3 | "version": "0.0.1",
4 | "description": "NodeBird API 서버-call",
5 | "main": "app.js",
6 | "scripts": {
7 | "start": "nodemon app",
8 | "test": "echo \"Error: no test specified\" && exit 1"
9 | },
10 | "author": "Junu",
11 | "license": "ISC",
12 | "dependencies": {
13 | "axios": "^0.17.1",
14 | "cookie-parser": "^1.4.3",
15 | "dotenv": "^5.0.1",
16 | "express": "^4.16.2",
17 | "express-session": "^1.15.6",
18 | "morgan": "^1.9.0",
19 | "pug": "^2.0.1"
20 | },
21 | "devDependencies": {
22 | "nodemon": "^1.14.11"
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-call/routes/index.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const axios = require('axios');
3 |
4 | const router = express.Router();
5 | const URL = 'http://localhost:8002/v2';
6 |
7 | const request = async (req, api) => {
8 | try {
9 | if (!req.session.jwt) {
10 | const tokenResult = await axios.post(`${URL}/token`, {
11 | clientSecret: process.env.CLIENT_SECRET,
12 | });
13 | req.session.jwt = tokenResult.data.token;
14 | }
15 | return await axios.get(`${URL}${api}`, {
16 | headers: { authorization: req.session.jwt },
17 | });
18 | } catch (error) {
19 | console.error(error);
20 | if (error.response.status < 500) {
21 | return error.response;
22 | }
23 | throw error;
24 | }
25 | };
26 |
27 | router.get('/mypost', async (req, res, next) => {
28 | try {
29 | const result = await request(req, '/posts/my');
30 | res.json(result.data);
31 | } catch (error) {
32 | console.error(error);
33 | next(error);
34 | }
35 | })
36 |
37 | router.get('/search/:hashtag', async (req, res, next) => {
38 | try {
39 | const result = await request(req, `/posts/hashtag/${encodeURIComponent(req.params.hashtag)}`);
40 | res.json(result.data);
41 | } catch (error) {
42 | if (error.code) {
43 | console.error(error);
44 | next(error);
45 | }
46 | }
47 | })
48 |
49 | router.get('/', (req, res) => {
50 | res.render('main', { key: process.env.CLIENT_SECRET });
51 | });
52 |
53 | module.exports = router;
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-call/views/error.pug:
--------------------------------------------------------------------------------
1 | h1= message
2 | h2= error.status
3 | pre #{error.stack}
--------------------------------------------------------------------------------
/JS/NodeJS/09_node_snsService-API/nodebird-call/views/main.pug:
--------------------------------------------------------------------------------
1 | doctype
2 | html
3 | head
4 | title 프론트 API 요청
5 | body
6 | #result
7 | script.
8 | var xhr = new XMLHttpRequest();
9 | xhr.onreadystatechange = function () {
10 | if (xhr.readyState === xhr.DONE) {
11 | if (xhr.status === 200) {
12 | document.querySelector('#result').textContent = xhr.responseText;
13 | } else {
14 | console.error(xhr.responseText);
15 | }
16 | }
17 | };
18 | xhr.open('POST', 'http://localhost:8002/v2/token');
19 | xhr.setRequestHeader('Content-Type', 'application/json');
20 | xhr.send(JSON.stringify({ clientSecret: '#{key}' }));
--------------------------------------------------------------------------------
/JS/NodeJS/nodejs_start/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["es2015"]
3 | }
--------------------------------------------------------------------------------
/JS/NodeJS/nodejs_start/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
--------------------------------------------------------------------------------
/JS/NodeJS/nodejs_start/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "nodejs_start",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1",
8 | "start": "DEBUG=express:* babel-node server.js"
9 | },
10 | "keywords": [],
11 | "author": "",
12 | "license": "ISC",
13 | "dependencies": {
14 | "babel-core": "^6.26.3",
15 | "babel-preset-es2015": "^6.24.1",
16 | "ejs": "^2.6.1",
17 | "express": "^4.16.4"
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/JS/NodeJS/nodejs_start/server.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const app = express();
3 | app.set('view engine', 'ejs');
4 |
5 | // 클라이언트에 get요청을 보냄.
6 | // get(라우팅, 콜백)
7 | app.get('/', (req, res) => {
8 | const message = 'Hello World!';
9 | res.render('index', {message});
10 | });
11 |
12 | // 포트를 수신할 주소를 정함
13 | // listen(포트, 콜백)
14 | app.listen(3001, () => {
15 | console.log('SERVER : Express app listining on port 3001');
16 | });
17 |
--------------------------------------------------------------------------------
/JS/NodeJS/nodejs_start/views/index.ejs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
Express Template
8 |
9 |
10 |
11 | <%= message %>
12 |
13 |
14 |
--------------------------------------------------------------------------------
/JS/_놀이_/discord/Discord.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junu126/TIL_JS/54f4b52fb330557c600e6e53c2bc98d4002ac56d/JS/_놀이_/discord/Discord.jpg
--------------------------------------------------------------------------------
/JS/_놀이_/discord/Discord_text.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junu126/TIL_JS/54f4b52fb330557c600e6e53c2bc98d4002ac56d/JS/_놀이_/discord/Discord_text.jpg
--------------------------------------------------------------------------------
/JS/_놀이_/discord/flower.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junu126/TIL_JS/54f4b52fb330557c600e6e53c2bc98d4002ac56d/JS/_놀이_/discord/flower.jpg
--------------------------------------------------------------------------------
/JSON/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | // IntelliSense를 사용하여 가능한 특성에 대해 알아보세요.
3 | // 기존 특성에 대한 설명을 보려면 가리킵니다.
4 | // 자세한 내용을 보려면 https://go.microsoft.com/fwlink/?linkid=830387을(를) 방문하세요.
5 | "version": "0.2.0",
6 | "configurations": [
7 | {
8 | "type": "node",
9 | "request": "launch",
10 | "name": "프로그램 시작",
11 | "program": "${file}",
12 | "outFiles": [
13 | "${workspaceFolder}/**/*.js"
14 | ]
15 | }
16 | ]
17 | }
--------------------------------------------------------------------------------
/Java/1. 표준입출력.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junu126/TIL_JS/54f4b52fb330557c600e6e53c2bc98d4002ac56d/Java/1. 표준입출력.pdf
--------------------------------------------------------------------------------
/Java/10-2. Swing응용과애니매이션.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junu126/TIL_JS/54f4b52fb330557c600e6e53c2bc98d4002ac56d/Java/10-2. Swing응용과애니매이션.pdf
--------------------------------------------------------------------------------
/Java/10. AWT와Swing.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junu126/TIL_JS/54f4b52fb330557c600e6e53c2bc98d4002ac56d/Java/10. AWT와Swing.pdf
--------------------------------------------------------------------------------
/Java/11. 제네릭.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junu126/TIL_JS/54f4b52fb330557c600e6e53c2bc98d4002ac56d/Java/11. 제네릭.pdf
--------------------------------------------------------------------------------
/Java/12. 쓰레드.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junu126/TIL_JS/54f4b52fb330557c600e6e53c2bc98d4002ac56d/Java/12. 쓰레드.pdf
--------------------------------------------------------------------------------
/Java/13. 스트림과 IO.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junu126/TIL_JS/54f4b52fb330557c600e6e53c2bc98d4002ac56d/Java/13. 스트림과 IO.pdf
--------------------------------------------------------------------------------
/Java/14. 컬렉션 프레임워크.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junu126/TIL_JS/54f4b52fb330557c600e6e53c2bc98d4002ac56d/Java/14. 컬렉션 프레임워크.pdf
--------------------------------------------------------------------------------
/Java/15. 네트워크.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junu126/TIL_JS/54f4b52fb330557c600e6e53c2bc98d4002ac56d/Java/15. 네트워크.pdf
--------------------------------------------------------------------------------
/Java/16. 로봇클래스.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junu126/TIL_JS/54f4b52fb330557c600e6e53c2bc98d4002ac56d/Java/16. 로봇클래스.pdf
--------------------------------------------------------------------------------
/Java/17장 JDBC 프로그래밍.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junu126/TIL_JS/54f4b52fb330557c600e6e53c2bc98d4002ac56d/Java/17장 JDBC 프로그래밍.pdf
--------------------------------------------------------------------------------
/Java/2. 변수와연산자.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junu126/TIL_JS/54f4b52fb330557c600e6e53c2bc98d4002ac56d/Java/2. 변수와연산자.pdf
--------------------------------------------------------------------------------
/Java/3. 조건문과반복문.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junu126/TIL_JS/54f4b52fb330557c600e6e53c2bc98d4002ac56d/Java/3. 조건문과반복문.pdf
--------------------------------------------------------------------------------
/Java/4. 배열과 참조타입.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junu126/TIL_JS/54f4b52fb330557c600e6e53c2bc98d4002ac56d/Java/4. 배열과 참조타입.pdf
--------------------------------------------------------------------------------
/Java/5. 클래스와객체.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junu126/TIL_JS/54f4b52fb330557c600e6e53c2bc98d4002ac56d/Java/5. 클래스와객체.pdf
--------------------------------------------------------------------------------
/Java/6. 상속.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junu126/TIL_JS/54f4b52fb330557c600e6e53c2bc98d4002ac56d/Java/6. 상속.pdf
--------------------------------------------------------------------------------
/Java/7. 추상클래스와인터페이스.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junu126/TIL_JS/54f4b52fb330557c600e6e53c2bc98d4002ac56d/Java/7. 추상클래스와인터페이스.pdf
--------------------------------------------------------------------------------
/Java/8. 예외처리.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junu126/TIL_JS/54f4b52fb330557c600e6e53c2bc98d4002ac56d/Java/8. 예외처리.pdf
--------------------------------------------------------------------------------
/Java/9. 기본 API 클래스.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junu126/TIL_JS/54f4b52fb330557c600e6e53c2bc98d4002ac56d/Java/9. 기본 API 클래스.pdf
--------------------------------------------------------------------------------
/Java/studing/Codeup1286.java:
--------------------------------------------------------------------------------
1 | package studing;
2 |
3 | import java.util.*;
4 |
5 | public class Codeup1286 {
6 | public static void main(String[] args){
7 | int biggest = -100000000;
8 | int smallest = 100000000;
9 |
10 | Scanner t = new Scanner(System.in);
11 |
12 | for(int i = 0; i < 5; i++)
13 | {
14 | int comp = t.nextInt();
15 | if(biggest <= comp)
16 | {
17 | biggest = comp;
18 | }
19 |
20 | if(smallest >= comp)
21 | {
22 | smallest = comp;
23 | }
24 | }
25 |
26 | System.out.println(biggest);
27 |
28 | System.out.println(smallest);
29 |
30 | t.close();
31 |
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/Java/studing/Codeup1295.java:
--------------------------------------------------------------------------------
1 | package studing;
2 |
3 | import java.util.*;
4 |
5 | public class Codeup1295 {
6 | public static void main(String[] args){
7 |
8 | Scanner t = new Scanner(System.in);
9 |
10 | String s = t.nextLine();
11 |
12 | char s_arr[] = new char[s.length()];
13 |
14 | for(int i = 0; i < s.length(); i++)
15 | {
16 | s_arr[i] = s.charAt(i);
17 | }
18 |
19 | for(int i = 0; i < s.length(); i++)
20 | {
21 | if(s_arr[i] >= 65 && s_arr[i] <= 90)
22 | {
23 | s_arr[i] += 32;
24 | }
25 | else if(s_arr[i] >= 97 && s_arr[i] <= 122)
26 | {
27 | s_arr[i] -= 32;
28 | }
29 | else if( s_arr[i] == '.' )
30 | {
31 | s_arr[i] = '.';
32 | }
33 | else if( s_arr[i] == '!')
34 | {
35 | s_arr[i] = '!';
36 | }
37 | }
38 |
39 | for(int i = 0; i < s.length(); i++)
40 | {
41 | System.out.print(s_arr[i]);
42 | }
43 |
44 | t.close();
45 | }
46 | }
--------------------------------------------------------------------------------
/Java/studing/Study20180505.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junu126/TIL_JS/54f4b52fb330557c600e6e53c2bc98d4002ac56d/Java/studing/Study20180505.java
--------------------------------------------------------------------------------
/Java/studing/Study20180506.java:
--------------------------------------------------------------------------------
1 | package studing;
2 |
3 | public class Study20180506 {
4 |
5 | }
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # TIL_JS
2 | JS, CSS, HTML - STUDY
3 |
4 | 추가 +
5 |
6 | C언어 과제, 컴구과제
7 |
8 | 2018.05.08 JAVA 공부 +
9 |
--------------------------------------------------------------------------------
/TS/01. 기본타입.ts:
--------------------------------------------------------------------------------
1 | // 불리언
2 | const isTypeScriptAwesome: boolean = true;
3 | const doesJavaScriptHasTypes: boolean = false;
4 |
5 | // 숫자
6 | const yourScore: number = 100;
7 | const ieee7541sAwesome: number = 0.1 + 0.2; // 0.3000000000000004
8 |
9 | // 문자열
10 | const authorName: string = "안희종";
11 | const toReaders: string = `
12 | 책을 읽어주셔서 감사합니다.
13 | 도움이 되었으면 좋겠습니다.
14 | `;
15 |
16 | // null
17 | const nullValue: null = null;
18 | const numberValue: number = null; // strict 모드에서는 에러
19 |
20 | // undefined
21 | const undefinedValue: undefined = undefined;
22 |
23 | // any -> 타입 안정성에 구멍이 생겨서 ts사용 의의가 사라지므로 꼭 필요한 경우만
24 | let bool: any = true;
25 | bool = 3;
26 | bool = "whatever";
27 | bool = {};
28 |
29 | // void -> null과 undefined만 값으로 가질 수 있다. (아무것도 반환 X) ( 함수 용 )
30 | function nothing(): void {}
31 |
32 | // never -> 어떤 값도 가질 수 없다. ( 함수 용 )
33 | // alwaysThrow() 함수는 항상 에러를 throw 하므로 어떤 값도 반환하지 않는다.
34 | function alwaysThrow(): never {
35 | throw new Error("I'm a wicked function!");
36 | }
37 |
--------------------------------------------------------------------------------
/TS/02. 배열과 튜플.ts:
--------------------------------------------------------------------------------
1 | // 배열
2 | const pibonacci: number[] = [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];
3 | const myFavoriteBears: string[] = ["a", "b", "c", "d"];
4 |
5 | const pibonacci2: Array
= [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];
6 | const myFavoriteBears2: Array = ["0", "1", "2", "3", "4"];
7 |
8 | // 튜플
9 | const nameAndHeight: [string, number] = ["안희종", 176];
10 |
11 | // 명시한 튜플의 개수만큼 해야한느데 넘어서서 에러.
12 | //const invalidNameAndHeight: [string, number] = ["안희종", 176, true];
13 |
14 | const validNameAndHeight: [string, number] = ["안희종", 176];
15 | validNameAndHeight.push(42); // no error
16 | // Array.prototype.??? 이라는 메소드를 사용하면 no Error
17 |
--------------------------------------------------------------------------------
/TS/03. 객체.ts:
--------------------------------------------------------------------------------
1 | const user: { name: string; height: number } = {
2 | name: "안희종",
3 | height: 176
4 | };
5 |
6 | // type뒤에 '?'를 붙여주면 '존재하지 않을 수도 있다.' 를 표시
7 | const userWithUnkonowHeight: { name: string; height?: number } = {
8 | name: "김수한무"
9 | };
10 |
11 | const userReadOnly: { readonly name: string; height: number } = {
12 | name: "안희종",
13 | height: 176
14 | };
15 |
16 | // userReadOnly.name = 'asdf';
17 | // readonly키워드를 붙여주면 key에 해당하는 value를 수정 불가능해 진다. (상수화)
18 |
--------------------------------------------------------------------------------
/TS/04. 타입 별칭.ts:
--------------------------------------------------------------------------------
1 | // type NewType = Type; 을 통해 정의 가능.
2 | type UUID = string;
3 | type Height = number;
4 | type AnotherUUID = UUID;
5 |
6 | type Animal = string;
7 | type Animals = Animal[];
8 | const MyPets: Animals = ["tiger", "monkey", "dog"];
9 |
10 | type User = {
11 | name: string;
12 | height?: number;
13 | };
14 | function User(user: User): void {
15 | console.log(user.name);
16 | console.log(user.height);
17 | }
18 |
19 | const user: User = { name: "asdf", height: 123 };
20 | User(user);
21 | // User(123) => Error가 나옴. - 타입을 안맞춤.
22 | // 이때 에러는 User Type으로 나오는게 아니라 Object를 안맞쳣다고 나옴.
23 |
--------------------------------------------------------------------------------
/TS/05. 함수.ts:
--------------------------------------------------------------------------------
1 | // 함수 값의 타입 표기
2 | type SumFunction = (a: number, b: number) => number;
3 | const definitelySum: SumFunction = (a, b) => a + b;
4 | const sum: (a: number, b: number) => number = (a, b) => {
5 | return a + b;
6 | };
7 |
8 | // arrow함수를 통해 함수 만들기
9 | const logGreetings = (name: string): void => {
10 | console.log(`Hello, ${name}!`);
11 | };
12 |
13 | const notReallyVoid = (): void => {
14 | // return 1; // error TS2322: Type '1' is not assignable to type 'void'.
15 | };
16 |
17 | // 기본 매개변수
18 | const greetings = (name: string = "stranger"): void => {
19 | console.log(`Hello, ${name}`);
20 | };
21 | greetings("Heejong"); // Hello, Heejong!
22 | greetings(); // Hello, stranger!
23 |
24 | // 선택 매개변수
25 | const fetchVideo = (url: string, subTitleLanguage?: string) => {
26 | if (subTitleLanguage) {
27 | console.log("true");
28 | }
29 | };
30 | fetchVideo("https://example.com", "ko"); // true - noError
31 | fetchVideo("https://example.com"); // noError
32 |
33 | // const invalidFetchVideo = (subtitleUrl? : string, url: string) => {
34 | // // ...
35 | // }
36 | // error TS1016: A required parameter cannot follow an optional parameter.
37 | // 선택 매개변수는 requied한 매개변수 앞에 올 수 없다.
38 |
39 | // This 타입
40 | interface HTMLElement {
41 | tagName: string;
42 | }
43 |
44 | interface Handler {
45 | (this: HTMLElement, event: Event, callback: () => void): void;
46 | }
47 |
48 | let cb: any;
49 |
50 | const onClick: Handler = (event, cb) => {
51 | console.log(this.tagName);
52 | cb();
53 | };
54 |
55 | // this타입을 void로 명시시켜 this에 접근못하게 함.
56 | interface noThis {
57 | (this: void): void;
58 | }
59 |
60 | const noThis: noThis = () => {
61 | console.log(this.a); // Property 'a' does not exist on type 'void'.
62 | };
63 |
--------------------------------------------------------------------------------
/TS/06. 제너릭.ts:
--------------------------------------------------------------------------------
1 | // 제너릭 타입 변수
2 |
3 | /** | 함수 & 제너릭 |
4 | * 정의 시점 | 매개변수 | 타입변수 |
5 | * 정의 예시 | (a: any) => {} | type MyArry = T[] |
6 | * 사용 시 | 실제값 (3, 42)등 | 실제 타입 (number, strnig) 등 |
7 | * 사용 예시 | a(3); a(42); | type MyNumberArray = MyArray |
8 | */
9 |
10 | function getFirstelem(arr: T[]): T {
11 | return arr[0];
12 | }
13 |
14 | /*
15 | function 함수명<타입 변수> (인자 타입): 반환타입 {
16 | 본문
17 | }
18 | 의 형식으로 이루어진다.
19 | */
20 |
21 | const languages: string[] = ["TypeScript", "JavaScript"];
22 | const language = getFirstelem(languages);
23 | const language2 = getFirstelem([1, 2, 3]);
24 |
25 | type MyArray = T[];
26 | const drinks: MyArray = ["coffee", "Milk", "Beer"];
27 |
--------------------------------------------------------------------------------
/TS/07. 유니온 타입.ts:
--------------------------------------------------------------------------------
1 | // 유니온 타입 예제
2 | // 타입을 여러개 적을 수 있다.
3 | function square(value: number, returnString: boolean = false): string | number {
4 | const squared = value * value;
5 |
6 | if (returnString) {
7 | return squared.toString();
8 | }
9 |
10 | return squared;
11 | }
12 |
13 | const stringOrNumber: string | number = square(1, false);
14 |
15 | type SquaredType = string | number;
16 | function square2(value: number, returnString: boolean = false): SquaredType {
17 | const squared = value * value;
18 |
19 | if (returnString) {
20 | return squared.toString();
21 | }
22 |
23 | return squared;
24 | }
25 |
--------------------------------------------------------------------------------
/TS/08. 인터섹션 타입.ts:
--------------------------------------------------------------------------------
1 | type Programmer = { favoriteLanguage: string };
2 | type BeerLover = { favoriteBeer: string };
3 |
4 | // 인터섹션 타입 ( & ) 객체 타입 여러개의 속성을 모두 갖음.
5 | type BeerLovingProgrammer = Programmer & BeerLover;
6 | type Awesome = string & number & Programmer & BeerLover;
7 |
8 | // 어떤 값도 만족하지 못하는 인터섹션 타입
9 | type Infeasible = string & number; // 문자열과 숫자는 동시에 존재 못한다.
10 |
--------------------------------------------------------------------------------
/TS/10. 인터페이스 기초.ts:
--------------------------------------------------------------------------------
1 | // 인터페이스 ( interface ) <-- 값이 따라야 할 제약을 타입으로 표현.
2 | interface User {
3 | name: string;
4 | readonly height: number;
5 | favoriteLanguage?: string;
6 | }
7 | const author: User = {
8 | name: "안희종",
9 | height: 176 /* favoriteLanguage: 있어도 되고 엄서도댐 */
10 | };
11 |
12 | // error TS2540: Cannot assign to 'height' because it is a constant or a read-only property.
13 | // author.height = 183;
14 |
15 | // 함수 인터페이스
16 | // (함수명 : 매개변수 타입): 리턴 타입
17 | interface GetUserName {
18 | (user: User): string;
19 | }
20 | const getUserName: GetUserName = value => {
21 | return value.name;
22 | };
23 |
24 | // 하이브리드 타입
25 | interface Counter {
26 | (start: number): string;
27 | interval: number;
28 | reset(): void;
29 | }
30 | function getCounter(): Counter {
31 | let counter = function(start: number) {};
32 | counter.interval = 123;
33 | counter.reset = () => {};
34 | return counter;
35 | }
36 | let c = getCounter();
37 | c(10);
38 | c.reset();
39 | c.interval = 5.0;
40 |
41 | // 제너릭 인터페이스
42 | interface MyResponse {
43 | data: Data;
44 | status: number;
45 | ok: boolean;
46 | }
47 | interface User {
48 | name: string;
49 | readonly height: number;
50 | }
51 |
52 | // const user: MyResponse = await getUserApiCall(userId);
53 | // user.name;
54 |
55 | // 함수 인터페이스 정의 - 제너릭
56 | interface GetData {
57 | (response: MyResponse): Data;
58 | }
59 |
--------------------------------------------------------------------------------
/WebPack/.gitignore:
--------------------------------------------------------------------------------
1 | # 노드 모듈
2 | /node_modules
3 |
4 | # yarn
5 | /yarn.lock
--------------------------------------------------------------------------------
/WebPack/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | webpack study
6 |
7 |
8 |
9 | webpack study
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/WebPack/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "devDependencies": {
3 | "@babel/core": "^7.1.6",
4 | "@babel/preset-env": "^7.1.6",
5 | "babel-loader": "^7.1.5",
6 | "webpack": "^4.26.1",
7 | "webpack-cli": "^3.1.2",
8 | "webpack-command": "^0.4.2",
9 | "webpack-dev-server": "^3.1.10"
10 | },
11 | "dependencies": {
12 | "@babel/cli": "^7.1.5",
13 | "@webpack-cli/init": "^0.1.2",
14 | "babel": "^6.23.0",
15 | "babel-core": "^7.0.0-bridge.0",
16 | "babel-preset-env": "1.7.0"
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/WebPack/src/Utils.js:
--------------------------------------------------------------------------------
1 | export default class Utils {
2 | static (masage) {
3 | console.log('[Log] : ' + masage);
4 | }
5 | }
--------------------------------------------------------------------------------
/WebPack/src/app.js:
--------------------------------------------------------------------------------
1 | import Utils from './Utils';
2 |
3 | Utils.log('OMG so Hard!!!');
--------------------------------------------------------------------------------
/WebPack/webpack.config.js:
--------------------------------------------------------------------------------
1 | // webpack에서는 import, from을 사용할 수 없고 ES5문법인 require로 모듈을 불러와야한다.
2 | const webpack = require('webpack');
3 | const path = require('path');
4 |
5 | module.exports = {
6 | mode : 'development',
7 |
8 | entry : {
9 | app : './src/app.js',
10 | },
11 |
12 | output : {
13 | filename : 'bundle.js',
14 | path : path.join(__dirname, './dist'),
15 | },
16 |
17 | module : {
18 | rules : [
19 | {
20 | test : /\.js$/,
21 | exclude : /node_modules/,
22 | include : path.join(__dirname, './src'),
23 | use : [{
24 | loader : 'babel-loader',
25 | options : {
26 | presets : [ '@babel/preset-env' ],
27 | },
28 | }],
29 | },
30 |
31 | // 다른 loader를 설정할 때 배열의 다음 인덱스에 넣어줌.
32 | ],
33 | },
34 | }
--------------------------------------------------------------------------------
/python/FileInputOutput/abc.txt:
--------------------------------------------------------------------------------
1 | EEE
2 | DDD
3 | CCC
4 | BBB
5 | AAA
6 |
--------------------------------------------------------------------------------
/python/FileInputOutput/sample.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junu126/TIL_JS/54f4b52fb330557c600e6e53c2bc98d4002ac56d/python/FileInputOutput/sample.txt
--------------------------------------------------------------------------------
/python/FileInputOutput/test.txt:
--------------------------------------------------------------------------------
1 | Life is too short
--------------------------------------------------------------------------------
/python/FileInputOutput/test2.txt:
--------------------------------------------------------------------------------
1 | j
2 | 1
3 | 1
4 | 0
5 | 1
6 | 1
7 | 1
8 |
--------------------------------------------------------------------------------
/python/FileInputOutput/text.txt:
--------------------------------------------------------------------------------
1 | Life is too short
2 | you need python
--------------------------------------------------------------------------------
/python/FileInputOutput/새파일.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junu126/TIL_JS/54f4b52fb330557c600e6e53c2bc98d4002ac56d/python/FileInputOutput/새파일.txt
--------------------------------------------------------------------------------
/python/class.py:
--------------------------------------------------------------------------------
1 | class Calculator:
2 | def __init__(self):
3 | self.result = 0
4 |
5 | def add(self, num):
6 | self.result += num
7 | return self.result
8 |
9 | def sub(self, num):
10 | self.result -= num
11 | return self.result
12 |
13 | cal1 = Calculator()
14 | cal2 = Calculator()
15 |
16 | #print(cal1.add(10))
17 | #print(cal1.add(34))
18 | #print(cal2.add(10))
19 | #print(cal2.add(20))
20 | #print(cal1.sub(10))
21 | #print(cal1.sub(34))
22 | #print(cal2.sub(10))
23 | #print(cal2.sub(20))
24 |
25 | class FourCal:
26 | def __init__(self, num1 , num2):
27 | self.num1 = num1
28 | self.num2 = num2
29 |
30 | def setdata(self, num1, num2):
31 | self.num1 = num1
32 | self.num2 = num2
33 |
34 | def sum(self):
35 | return print(self.num1 + self.num2)
36 | def mul(self):
37 | return print(self.num1 * self.num2)
38 | def sub(self):
39 | return print(self.num1 - self.num2)
40 | def div(self):
41 | return print(int(self.num1 / self.num2))
42 |
43 | #a = FourCal(4,2)
44 |
45 | #a.setdata(4,2)
46 | #print(a.sum())
47 | #print(a.mul())
48 | #print(a.sub())
49 | #print(a.div())
50 |
51 | class MoreFourCal(FourCal):
52 | def pow(self):
53 | return print(self.num1 ** self.num2)
54 |
55 | class SafeFourCal(FourCal):
56 | def div(self):
57 | if self.num2 == 0:
58 | return 0
59 | else:
60 | self.num1 / self.num2
61 |
62 | a = MoreFourCal(4,0)
63 | b = SafeFourCal(4,0)
64 | a.sum()
65 | a.mul()
66 | a.sub()
67 | b.div()
68 | a.pow()
69 |
--------------------------------------------------------------------------------
/python/class문제.py:
--------------------------------------------------------------------------------
1 | # 상속하는 클래스 만들기
2 | class Calculator:
3 | def __init__(self):
4 | self.value = 0
5 |
6 | def add(self, val):
7 | self.value += val
8 | return self.value
9 |
10 | class UpgradeCalculator(Calculator):
11 | def minus(self, val):
12 | self.value -= val
13 | return self.value
14 |
15 | cal = UpgradeCalculator()
16 | print(cal.add(10))
17 | print(cal.minus(7))
18 |
19 | # 상속하는 클래스 만들기2
20 | class MaxLimitCalculator(Calculator):
21 | def add(self, val):
22 | self.value += val
23 | if self.value > 100:
24 | self.value = 100
25 | def value(self, val):
26 | return self.value
27 |
28 | cal1 = MaxLimitCalculator()
29 | cal1.add(50)
30 | cal1.add(60)
31 | print(cal1.value)
32 |
33 | # 지정된 클래스 작성
34 |
35 | class Calculator1:
36 | def __init__(self, _list):
37 | self.result = 0
38 | self._list = _list
39 | def sum(self):
40 | for i in self._list:
41 | self.result += i
42 | return self.result
43 | def avg(self):
44 | return self.result / len(self._list)
45 |
46 | cal1 = Calculator1([1,2,3,4,5])
47 | print(cal1.sum()) # 15
48 | print(cal1.avg()) # 3.0
49 |
50 | cal2 = Calculator1([6,7,8,9,10])
51 | print(cal2.sum()) # 40
52 | print(cal2.avg()) # 8.0
53 |
--------------------------------------------------------------------------------
/python/for문.py:
--------------------------------------------------------------------------------
1 | # 1번 문제
2 |
3 | #for a in range(1,101):
4 | # print(a)
5 |
6 | # 2번 문제
7 |
8 | #_sum = 0
9 | #for i in range(1,1001):
10 | # if i % 5 == 0:
11 | # _sum = i + _sum
12 | #print(_sum)
13 |
14 | # 3번 문제
15 |
16 | #_sum = 0
17 | #A = [70, 60, 55, 75, 95, 90, 80, 80, 85, 100]
18 | #for i in A:
19 | # _sum = _sum + i
20 | #ave = _sum / 10
21 | #print(ave)
22 |
23 | # 4번 문제
24 |
25 |
26 | #bloodType = ['A', 'B', 'A', 'O', 'AB', 'AB', 'O', 'A', 'B', 'O', 'B', 'AB']
27 | #result = {}
28 |
29 | #for i in bloodType:
30 | # if i in result:
31 | # result[i] += 1
32 | # else:
33 | # result[i] = 1
34 | #print(result)
35 |
36 | # 5번 문제
37 |
38 | #numbers = [1,2,3,4,5]
39 | #result = [n * 2 for n in numbers if n% 2 == 1]
40 | #print(result)
41 |
42 | # 6번 문제
43 |
44 | #que = 'Life is too short, you need python'
45 | #ans = 'aeiou'
46 | #a=''.join( [i for i in que if i not in ans] )
47 | #print(a)
48 |
--------------------------------------------------------------------------------
/python/func.py:
--------------------------------------------------------------------------------
1 | # 기본 함수 문법
2 |
3 | def sumFunc(a,b):
4 | return a+b
5 |
6 | print(sumFunc(3,4))
7 |
8 | # 람다 함수 문법
9 |
10 | sumLamb = lambda a,b: a+b
11 | print(sumLamb(3,4))
12 |
13 | # 홀수 짝수 판별
14 |
15 | def is_odd(num = int(input())):
16 | if num % 2 == 0:
17 | return '짝수'
18 | else:
19 | return '홀수'
20 | print(is_odd())
21 |
22 | # 평균값 계산
23 |
24 | def aver(*args):
25 | _sum = 0
26 | for i in args:
27 | _sum = _sum + i
28 | return _sum / len(args)
29 | print(aver(90,80,70))
30 |
31 | # 구구단 출력
32 |
33 | def GuGuDan(n=int(input())):
34 | if n >= 2 and n <= 9:
35 | i = 0
36 | _n = 0
37 | while i < 9:
38 | i+=1
39 | _n = _n + n
40 | print(_n, end=" ")
41 | else:
42 | print('2에서 9사이의 수를 입력해주세요.')
43 | GuGuDan()
44 |
45 | # 답지의 구구단
46 |
47 | def gugu(n):
48 | for i in range(1,10):
49 | print('\n',n*i)
50 | gugu(2)
51 |
52 | # 피보나치 수열
53 |
54 | def fibo(n):
55 | if n == 0: return 0
56 | if n == 1: return 1
57 | return fibo(n-2) + fibo(n-1)
58 | for i in range(int(input())):
59 | print(fibo(i), end=" ")
60 |
61 | # 5보다 큰 수만 -> lambda함수로 변경
62 |
63 | func = lambda numbers: [number for number in numbers if number > 5]
64 | print(func([2,3,4,5,6,7,8]))
65 |
--------------------------------------------------------------------------------
/python/if문.py:
--------------------------------------------------------------------------------
1 | # if문 문제 2
2 |
3 | lucky_list = [1, 9, 23, 46]
4 | a = int(input("당신의 행운권 번호는? : "))
5 |
6 | if a in lucky_list:
7 | print('야호')
8 | else:
9 | print("ㅇㄴ")
10 |
11 | # if문 문제 3
12 |
13 | a = int(input())
14 |
15 | if a % 2 == 0:
16 | print("짝수")
17 | else:
18 | print("홀수")
19 |
20 | # if문 문제 4
21 |
22 | a = int(input("당신의 나이를 입력하세요 : "))
23 | b = int(input("당신의 키를 입력하세요 : "))
24 |
25 | if a < 30 and b >= 175:
26 | print("YES")
27 | else:
28 | print("NO")
29 |
--------------------------------------------------------------------------------
/python/while문.py:
--------------------------------------------------------------------------------
1 | # 1번 문제
2 |
3 | num = 0
4 | ans = 0
5 | while num < 100:
6 | num = num+1
7 | ans = num + ans
8 | print(ans)
9 |
10 | # 2번 문제
11 |
12 | num = 0
13 | ans = 0
14 |
15 | while num != 1000:
16 | num = num + 1
17 | if num % 3 == 0:
18 | ans = ans + num
19 | print(ans)
20 |
21 | # 3번 문제
22 |
23 | A = [20, 55, 67, 82, 45, 33, 90, 87, 100, 25]
24 | i = 0
25 | ans = 0
26 |
27 | while i != 10:
28 | if A[i] >= 50:
29 | ans = ans + A[i]
30 | i= i + 1
31 | print(ans)
32 |
33 | # 4번 문제
34 |
35 | i = 0
36 | while True:
37 | i += 1
38 | if i < 5:
39 | print("*" * i)
40 |
41 | # 5번 문제
42 |
43 | i = 7
44 | space = 0
45 |
46 | while i > 0:
47 | print(' ' * space + "*" * i)
48 | i -= 2
49 | space += 1
50 |
--------------------------------------------------------------------------------
/python/새파일.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junu126/TIL_JS/54f4b52fb330557c600e6e53c2bc98d4002ac56d/python/새파일.txt
--------------------------------------------------------------------------------
/python/입출력.py:
--------------------------------------------------------------------------------
1 | # 파일 만들기 & 입력
2 |
3 |
4 | ## 'w'형식은 전체를 지우고 다시 쓰는것이다. (때문에 생성이 가능)
5 | f1 = open('./FileInputOutput/새파일.txt', 'w')
6 | for i in range(10):
7 | hit = "{0}번째 공격입니다.\n".format(i)
8 | f1.write(hit)
9 | f1.close()
10 |
11 | # 파일 읽기 - 한 줄
12 |
13 | f2 = open('./FileInputOutput/새파일.txt', 'r')
14 |
15 | ## readline은 한줄씩 저장
16 | line = f2.readline()
17 | print(line)
18 | f2.close()
19 |
20 | # 파일 읽기 - 전체 줄 - 방법1
21 |
22 | f3 = open('./FileInputOutput/새파일.txt', 'r')
23 |
24 | while True:
25 | line = f3.readline()
26 | if not line: break
27 | print(line)
28 |
29 | f3.close()
30 |
31 | # 파일 읽기 - 전체 줄 - 방법2
32 |
33 | f4 = open('./FileInputOutput/새파일.txt', 'r')
34 |
35 | ## readlines()는 리스트로 저장. => ['0번째 공격입니다.', '1번째...']
36 | lines = f4.readlines()
37 | for i in lines:
38 | print(i)
39 |
40 | f4.close()
41 |
42 | # 파일 읽기 - 전체 줄 - 방법3
43 |
44 | f5 = open('./FileInputOutput/새파일.txt', 'r')
45 |
46 | ## read()는 전체를 문자열로 저장.
47 |
48 | data = f5.read()
49 | print(data)
50 |
51 | f5.close()
52 |
53 | # 파일에 내용 추가하기
54 |
55 | ## 'a'형식은 파일의 내용을 삭제 안하고 추가.
56 | f6 = open('./FileInputOutput/새파일.txt', 'a')
57 |
58 | for i in range(10, 21):
59 | value = '{0}번째 공격입니다.\n'.format(i)
60 | f6.write(value)
61 |
62 | f6.close()
63 |
64 | # 다른 문법
65 |
66 | with open('./FileInputOutput/새파일.txt', 'w') as f7:
67 | for i in range(21,31):
68 | f7.write("{0}번째 공격입니다.\n".format(i))
69 |
70 |
--------------------------------------------------------------------------------
/python/입출력문제.py:
--------------------------------------------------------------------------------
1 | # 파일 읽고 출력하기
2 |
3 | with open("./FileInputOutput/test.txt", 'w') as f1:
4 | f1.write("Life is too short")
5 |
6 | with open("./FileInputOutput/test.txt", 'r') as f2:
7 | print(f2.read())
8 |
9 | # 파일저장
10 |
11 | with open('./FileInputOutput/test2.txt', 'a') as f3:
12 | _input = input()
13 | f3.write("{0}\n".format(_input))
14 |
15 | # 역순 저장
16 |
17 | with open('./FileInputOutput/abc.txt', 'r') as f4:
18 | txt = f4.readlines()
19 |
20 | _txt = reversed(txt)
21 |
22 | with open('./FileInputOutput/abc.txt', 'w') as f4:
23 | for i in _txt:
24 | i = i.strip()
25 | f4.write(i)
26 | f4.write('\n')
27 |
28 | # 파일 수정
29 |
30 | with open('./FileInputOutput/text.txt', 'r') as f5:
31 | reading = f5.read()
32 | creading = reading.replace('java','python')
33 | with open('./text.txt', 'w') as f5:
34 | f5.write(creading)
35 |
36 | # 평균값 구하기
37 |
38 | with open('./FileInputOutput/sample.txt', 'r') as f6:
39 | num = f6.readlines()
40 |
41 | _sum = 0
42 | for i in num:
43 | _sum += int(i)
44 | aver = _sum / len(num)
45 |
46 | with open('./FileInputOutput/sample.txt', 'a') as f6:
47 | f6.write('\n\n 총합 : {0}\n평균 : {1}'.format(_sum, aver))
48 |
--------------------------------------------------------------------------------
/test/Test's-Jest.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junu126/TIL_JS/54f4b52fb330557c600e6e53c2bc98d4002ac56d/test/Test's-Jest.md
--------------------------------------------------------------------------------