jsdevkr / gitcodeshare.com Goto Github PK
View Code? Open in Web Editor NEWContributhon 2018 - gitCodeShare.com (a.k.a gitShare)
Home Page: https://gitcodeshare.com
License: MIT License
Contributhon 2018 - gitCodeShare.com (a.k.a gitShare)
Home Page: https://gitcodeshare.com
License: MIT License
There is an issue when HTTP method is POST passport doesn't call serialize & deserialize (req.user is undefined).
I googled, but I didn't find a solution yet.
Here is my code
server.use(cookieParser(process.env.COOKIE_SECRET));
server.use(bodyParser.json());
server.use(bodyParser.urlencoded({ extended: false }));
server.use(
session({
genid: function() {
return uuid();
},
store: new RedisStore({
client: client,
logErrors: true,
}),
secret: process.env.SESSION_SECRET,
saveUninitialized: false,
resave: false,
cookie: {
signed: true,
maxAge: 1000 * 60 * 60 * 4,
httpOnly: true,
},
}),
);
const postGist = (req: Request, res: Response, next: NextFunction) => {
request.post(
`https://api.github.com/gists`,
{
json: true,
body: JSON.stringify(req.body),
headers: {
Authorization: `token ${req.user.accessToken}`, // TypeError: Cannot read property 'accessToken' of undefined
'Content-Type': 'application/json; charset=utf-8',
'User-Agent': `${name}/${version}`,
},
withCredentials: true,
},
(err, response, body) => {
if (err) {
return next(err);
}
res.send(body);
},
);
};
References
http://es6-features.org/
I saw that chrome extensions should be in one directory. Is this true? If it true, Where should we store Chrome extensions?
How about an octotree's structure? In octotree case, octotree/src/config/chrome/ has octotree chrome extension code stored.
Today, I found nice site for developing backend oauth2.0 using passport
passport-github repository
passport tutorial
@aeei @gimdongwoo @thomasJang
I have some question!
Do we have to store user detail into database?
or just oauth api call to autenticate?
• Learning the express module in Node.js
• Using Orientdb to build a web application
today
tomorrow
Need $5.00 registration fee to register the chrome web store developer.
I think it's good to make official google account like [email protected]
and register that account.
Then we can use this account for our project official.
next js has lower barrier to entry than I thought. though I don't know well about SSR, it was not hard to understand. It was interesting that the structure was forced unlike create react app. If you haven't already seen it, I hope you'll take a look. our project is almost like nextjs-express-startkit.
Chrome extension popup file must be a static HTML file.
So I think we have two options.
Generate popup.html file through like next export
command and include in chrome extension folder.
Use iframe
tag like <iframe src="{ server_url }/popup">
to also server-side render for popup.
(Ref : https://stackoverflow.com/questions/40608175/render-chrome-extension-popup-ui-dynamically)
Which one is the better solution?
learn React at Youtube channel(velopert)
today saw React for beginner.
also, learn to webpack contents in webpack docs.
today's learning time: 1hr
total learning time: 3hr
- interface basic
- duck typing
- interface optional props => ? behind interface props
- prevent runtime type error
- And make type extend scalable at the same time
class Parent {
data:any[];
constructor(){
this.data = [];
}
push(item) {
this.data.push(item);
}
}
const p = new Parent();
p.push(1);
p.push('1');
p.data = p.data.map(v => v.toFixed()); // type error
// extend Number type
class Child extends Parent {
push(item: number) {
super.push(item);
}
}
const c = new Child();
c.push(1);
c.push('1');
c.data = c.data.map(v => v.toFixed()); // clean
// but at various type ?
// use generic
class Parent<T> {
protected data: Array<T> = [];
push(item) {
this.data.push(item);
}
}
const numArr = new Parent<number>();
numArr.push(1);
numArr.push('1') // compile error
const objArr = new Parent<{num: number, str: string}>();
objArr.push({num: '1', str: 1}) // compile error
[Study] Read article for typescript, React, MobX
Read follow this:
We should basically know about React and Typescripts. I have looked at the above for this.
also, I have not used MobX before. because of I looked at the MobX documentation.
today's learning time: 1hr
total learning time: 1hr
suggest below two lib for more convenient and systematic ours opensource project gitCodeShare!
easliy sync ours github project and test code in convenient.
for example build error, lint error etc...
commitlint is Lint commit messages. if use this lib then commit message display According to purpose
for example test: blah blah, ci: blah blah, docs: blah blah
Read the JavaScript tutorial
Read the React tutorial
Create a To-Do List App with basic functionality
Let's continue developing along with studying React.
[Question] How to store access token?
So, I thought...
Which way is the best? or something else?
cc. @gimdongwoo , @thomasJang , @umanking , @Parkkkkk
I'v tried to apply mobx in react todo application project, but jsx is not familiar to me.
So I expect it'll take a lot of time.
Maybe I think I can try to appling typescript in Mobx + react application in next week.
If use pyenv and don't select any python, you facing this error even though you installed python in the system. I think it is to be a related with node-gyp.
gyp ERR! configure error
gyp ERR! stack Error: Command failed: /Users/jonghojeong/.pyenv/shims/python2 -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack pyenv: python2: command not found
gyp ERR! stack
gyp ERR! stack The `python2' command exists in these Python versions:
gyp ERR! stack 2.7.6
gyp ERR! stack 2.7.6/envs/test
gyp ERR! stack 2.7.8
gyp ERR! stack 2.7.8/envs/dietnote_server
gyp ERR! stack dietnote_server
gyp ERR! stack test
gyp ERR! stack
gyp ERR! stack
gyp ERR! stack at ChildProcess.exithandler (child_process.js:275:12)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at maybeClose (internal/child_process.js:925:16)
gyp ERR! stack at Socket.stream.socket.on (internal/child_process.js:346:11)
gyp ERR! stack at emitOne (events.js:116:13)
gyp ERR! stack at Socket.emit (events.js:211:7)
gyp ERR! stack at Pipe._handle.close [as _onclose] (net.js:567:12)
gyp ERR! System Darwin 17.7.0
gyp ERR! command "/usr/local/bin/node" "/Users/jonghojeong/source/gitCodeShare.com/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /Users/jonghojeong/source/gitCodeShare.com/node_modules/node-sass
gyp ERR! node -v v8.10.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
I solved this problem through select python version in pyenv like this.
pyenv shell "PYTHON VERSION YOU WANT"
Boilerplate
learn Typescript at Typescript Handbook for korean
also, Today My Team - 'Chrome extension' made an online meeting on 10 pm. - We shared our thoughts on Chrome Extensions.
I join to Typescript study group in my community!
today's learning time: 1hr
total learning time: 4hr
read document
watched video tutorials
• Connecting servers with typescript [50%]
• Read the gist API
• typescript grammar study
learn to chrome extension
Read follow this:
Getting Started Tutorial to chrome extension
and write example chrome-extension follow this:
{
"author": "rayleigh",
"manifest_version": 2,
"locale": "en ",
"name": "extension tutorial",
"short_name": "ex tuto",
"description": "extension tutorial for gitcodeshare",
"version": "0.0.1",
"version_name": "preview",
"browser_action": {
"default_icon": "hello extension.png",
"default_popup": "hello.html"
},
"icons": {
"128": "hello extension.png"
},
"permissions": [
"activeTab", "http://*/*", "https://*/*"
]
}
I can't proceed because we need to register as a developer at chrome extension.
So we need a developer registration to chrome extension.
today's learning time: 1hr
total learning time: 2hr
• study typescript
• Create a CRUD with Node.js
If there is a key should not be exposed, how can I management and shared with developers?
If I registered key into .gitignore file, I cannot share the key with developers.
In the opposite case, the key can be exposed.
How should I do?
I think labels are a great tool for managing issues efficiently.
(handlers/passport.ts)
server.use(function(req, res, next) {
if (req.url.match('/_next/*') || req.url.match('/static/*')) {
next();
} else {
passport.session()(req, res, next);
}
});
(handlers/gist.ts)
list
References
https://dev.to/briandgls/using-typescript-with-express--e0k
So we can set Assignees, Label, Projects, etc. on the right side. ->
But now we can't.
Request @gimdongwoo @thomasJang
Method | Routes | Description |
---|---|---|
GET | /gists | List of gists |
GET | /gists/:gist_id | Get single gists |
FETCH | /gists/:gist_id | Edit gists |
POST | /gists | Create gists |
Create OAuth app, we need to get client_id
client_secret
cc. @gimdongwoo @thomasJang
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.