<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Jacobkim</title>
    <description>The latest articles on Forem by Jacobkim (@jacobkim9881).</description>
    <link>https://forem.com/jacobkim9881</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F267344%2F3c0ef097-3cad-4d26-9db4-673b709b4574.jpg</url>
      <title>Forem: Jacobkim</title>
      <link>https://forem.com/jacobkim9881</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/jacobkim9881"/>
    <language>en</language>
    <item>
      <title>'res.json()'s are different between a backend server and a frontend server</title>
      <dc:creator>Jacobkim</dc:creator>
      <pubDate>Wed, 24 Feb 2021 16:32:10 +0000</pubDate>
      <link>https://forem.com/jacobkim9881/res-json-s-are-different-between-a-backend-server-and-a-frontend-server-d97</link>
      <guid>https://forem.com/jacobkim9881/res-json-s-are-different-between-a-backend-server-and-a-frontend-server-d97</guid>
      <description>&lt;p&gt;While building web servers(Backend and frontend), I found information that responses between backend and frontend are different. As a backend server a response has information for backend server(Like server, socket, session, header and etc...) but as a frontend server a response has information for the frontend server(like header options, status, and etc...).&lt;/p&gt;

&lt;p&gt;At a frontend server fetch loads json file like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://jsonplaceholder.typicode.com/todos/1&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

&lt;span class="c1"&gt;//answer: Object { userId: 1, id: 1, title: "delectus aut autem", completed: false }&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let me make a browser console response for fetch:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://jsonplaceholder.typicode.com/todos/1&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And console logged below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Response
​
body: ReadableStream { locked: false }
​
bodyUsed: false
​
headers: Headers {  }
​
ok: true
​
redirected: false
​
status: 200
​
statusText: "OK"
​
type: "cors"
​
url: "https://jsonplaceholder.typicode.com/todos/1"
​
&amp;lt;prototype&amp;gt;: ResponsePrototype { clone: clone(), arrayBuffer: arrayBuffer(), blob: blob(), … }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A response has such information on a browser.&lt;/p&gt;

&lt;p&gt;On express.js server a response sends JSON like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="na"&gt;data&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;example&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/home&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;//{data : 'example'}&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let me make the server console a response:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/home&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;end&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And I got long logs like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;_readableState: ...
...
&amp;lt;ref *2&amp;gt; IncomingMessage {
  _readableState: ReadableState {
    objectMode: false,
    highWaterMark: 16384,
    buffer: BufferList { head: null, tail: null, length: 0 },
    length: 0,
    pipes: [],
    flowing: null,
    ended: false,
    endEmitted: false,
    reading: false,
    sync: true,
    needReadable: false,
    emittedReadable: false,
    readableListening: false,
    resumeScheduled: false,
    errorEmitted: false,
    emitClose: true,
    autoDestroy: false,
    destroyed: false,
    errored: null,
    closed: false,
    closeEmitted: false,
    defaultEncoding: 'utf8',
    awaitDrainWriters: null,
    multiAwaitDrain: false,
    readingMore: true,
    decoder: null,
    encoding: null,
    [Symbol(kPaused)]: null
  },
  _events: [Object: null prototype] { end: [Function: clearRequestTimeout] },
  _eventsCount: 1,
  _maxListeners: undefined,
  socket: &amp;lt;ref *1&amp;gt; Socket {
    connecting: false,
    _hadError: false,
    _parent: null,
    _host: null,
    _readableState: ReadableState {
      objectMode: false,
      highWaterMark: 16384,
      buffer: BufferList { head: null, tail: null, length: 0 },
      length: 0,
      pipes: [],
      flowing: true,
      ended: false,
      endEmitted: false,
      reading: true,
      sync: false,
      needReadable: true,
      emittedReadable: false,
      readableListening: false,
      resumeScheduled: false,
      errorEmitted: false,
      emitClose: false,
      autoDestroy: false,
      destroyed: false,
      errored: null,
      closed: false,
      closeEmitted: false,
      defaultEncoding: 'utf8',
      awaitDrainWriters: null,
      multiAwaitDrain: false,
      readingMore: false,
      decoder: null,
      encoding: null,
      [Symbol(kPaused)]: false
    },
...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A response on a backend server has other messages now like a frontend server.&lt;/p&gt;

&lt;p&gt;So &lt;code&gt;res.json()&lt;/code&gt; looks same but has a different meaning between a backend server and a frontend server.&lt;/p&gt;

&lt;p&gt;For example this fetch doesn't work on a frontend server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://jsonplaceholder.typicode.com/todos/1&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;()})&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="c1"&gt;//undefined&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But this works:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://jsonplaceholder.typicode.com/todos/1&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What's different as ES6 code? The first one doesn't return &lt;code&gt;response.json()&lt;/code&gt; but the other does &lt;code&gt;return&lt;/code&gt; because arrow function automatically returns without bracket. If like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://jsonplaceholder.typicode.com/todos/1&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;()})&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

&lt;span class="c1"&gt;//answer: Object { userId: 1, id: 1, title: "delectus aut autem", completed: false }&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;then it will show the JSON. &lt;/p&gt;

&lt;p&gt;But we use &lt;code&gt;res.json()&lt;/code&gt; without return on express.js like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="na"&gt;data&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;example&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/home&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;//without return&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So &lt;code&gt;res.json()&lt;/code&gt; for a frontend server shouldn't be used as a backend server. For fullstack developers these should be aware as different meanings.&lt;/p&gt;

</description>
      <category>json</category>
      <category>es6</category>
      <category>fetch</category>
      <category>fullstack</category>
    </item>
    <item>
      <title>Hosting web server at cafe24(Getting a job in Korea)</title>
      <dc:creator>Jacobkim</dc:creator>
      <pubDate>Wed, 08 Apr 2020 09:39:11 +0000</pubDate>
      <link>https://forem.com/jacobkim9881/hosting-web-server-at-cafe24-getting-a-job-in-korea-f67</link>
      <guid>https://forem.com/jacobkim9881/hosting-web-server-at-cafe24-getting-a-job-in-korea-f67</guid>
      <description>&lt;p&gt;Liquid syntax error: 'raw' tag was never closed&lt;/p&gt;
</description>
      <category>node</category>
      <category>mysql</category>
      <category>git</category>
    </item>
    <item>
      <title>Running node server with mysql on my smartphone</title>
      <dc:creator>Jacobkim</dc:creator>
      <pubDate>Thu, 02 Apr 2020 01:17:51 +0000</pubDate>
      <link>https://forem.com/jacobkim9881/running-node-server-with-mysql-on-my-smartphone-1eb3</link>
      <guid>https://forem.com/jacobkim9881/running-node-server-with-mysql-on-my-smartphone-1eb3</guid>
      <description>&lt;h2&gt;
  
  
  Before you root your phone...
&lt;/h2&gt;

&lt;p&gt;On this post I wanna show how to run node server with mysql on a galaxy smartphone. It seems a smartphone could be used as a linux system with wifi. But it &lt;strong&gt;could damage your software&lt;/strong&gt; in your smartphone so I suggest you &lt;strong&gt;don't try to root your phone&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rooting a galaxy smartphone
&lt;/h2&gt;

&lt;p&gt;To run mysql on a smartphone accessing root is needed. Most of smartphone brands choose one OS between iOS and Android. And mysql servers often run on linux which use kernel as Android and iOS use too! But root permission is officialy blocked on mobile OS, which changing to rooted kernel is needed. Since kernel is forced to rooted one any damage on mobile system isn't supported by A/S. &lt;/p&gt;

&lt;p&gt;Odin is changing kernel on a smartphone connected to a desktop. I downloaded one click root so it wasn't that hard to root. I followed this guide : &lt;a href="https://www.oneclickroot.com/root/alps-qmobile-a550-alps-jb5-mp-v1-6-4-2-2/"&gt;https://www.oneclickroot.com/root/alps-qmobile-a550-alps-jb5-mp-v1-6-4-2-2/&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Download the zip file.&lt;/li&gt;
&lt;li&gt;Unzip the file in wherever you want.&lt;/li&gt;
&lt;li&gt;Download Samsung USB Driver at here: &lt;a href="https://developer.samsung.com/mobile/android-usb-driver.html"&gt;https://developer.samsung.com/mobile/android-usb-driver.html&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Turning on USB Debugging on your smartphone.&lt;/li&gt;
&lt;li&gt;Turn off your smartphone.&lt;/li&gt;
&lt;li&gt;Plug off usb connector form your smartphone.&lt;/li&gt;
&lt;li&gt;Start with download mode of your smartphone(by pushing for seconds volume down button + home button + power button).&lt;/li&gt;
&lt;li&gt;After your smartphone asking download mode, pushing volume up button.&lt;/li&gt;
&lt;li&gt;Connect your smartphone to your desktop with usb connector.&lt;/li&gt;
&lt;li&gt;Execute odin file and kernel is changed.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Linux terminal on your smartphone
&lt;/h2&gt;

&lt;p&gt;After your smartphone is rebooted now can you access root permission! Though you could get breaked in from hackers, you can use yours like linux OS. I hope you use dark power with a care! :D Let's download some applications :&lt;br&gt;
Termux: termux.com/&lt;br&gt;
&lt;a href="https://play.google.com/store/apps/details?id=com.joeykrim.rootcheck"&gt;https://play.google.com/store/apps/details?id=com.joeykrim.rootcheck&lt;/a&gt;&lt;br&gt;
Root Checker: &lt;a href="https://play.google.com/store/apps/details?id=com.joeykrim.rootcheck"&gt;https://play.google.com/store/apps/details?id=com.joeykrim.rootcheck&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Termux can make you run terminal and command on your smartphone as linux users command. We will install packages for node modules.&lt;br&gt;
After running Termux you can see terminal on a smartphone. You can command as you do on linux terminal but accessing root have been blocked by mobile OS kernel. &lt;/p&gt;
&lt;h2&gt;
  
  
  Adding sudo command in Termux
&lt;/h2&gt;

&lt;p&gt;After rooting your phone and entering Termux we need add sudo command which haven't been loaded on Termux from 'termux-sudo' git. We are at $HOME directory if not, type &lt;code&gt;cd $HOME&lt;/code&gt;. You can check where you are in Termux by typing &lt;code&gt;pwd&lt;/code&gt; command. First, type &lt;code&gt;apt upgrade &amp;amp;&amp;amp; apt update&lt;/code&gt; and install git for git clone to type &lt;code&gt;pkg install git&lt;/code&gt;. Now we extracting termux-sudo typing &lt;code&gt;git clone https://gitlab.com/st42/termux-sudo.git&lt;/code&gt; We need dependency so type &lt;code&gt;pkg install ncurses-utils&lt;/code&gt;. After extraction is finished type &lt;code&gt;cd termux-sudo&lt;/code&gt;. Now we are at 'termux-sudo' directory. Type below,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cat sudo &amp;gt; /data/data/com.termux/files/usr/bin/sudo
chmod 700 /data/data/com.termux/files/usr/bin/sudo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;termux-sudo git page for extraction is here: &lt;br&gt;
&lt;a href="https://gitlab.com/st42/termux-sudo"&gt;https://gitlab.com/st42/termux-sudo&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Install node.js &amp;amp; vim
&lt;/h2&gt;

&lt;p&gt;We will run node server so we install node package manager. Type &lt;code&gt;pkg install nodejs&lt;/code&gt;. Also type &lt;code&gt;pkg install vim&lt;/code&gt; to edit scripts. If we don't copy&amp;amp;paste .js files from our desktop, we should be used to scripts on black screen without a mouse! &lt;/p&gt;

&lt;h2&gt;
  
  
  Make your termux save your files in smartphone storage
&lt;/h2&gt;

&lt;p&gt;Before make webserver we should make Termux save files in smartphone storage. Termux couldn't go out of limited path so couldn't access directories in SD card to bring your file into. First, we go to &lt;a href="https://wiki.termux.com/wiki/Termux-setup-storage"&gt;'Settings&amp;gt;Apps&amp;gt;Termux&amp;gt;Permissions&amp;gt;Storage' on the smartphone and set to true&lt;/a&gt;. Type &lt;code&gt;termux-setup-storage&lt;/code&gt; and &lt;code&gt;cd ~/storage/downloads&lt;/code&gt; on your Termux. Now you can copy&amp;amp;paste your files from your desktop to your phone with USB connect in downloads folder. Let's check your path with typing &lt;code&gt;pwd&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Install npm packages
&lt;/h2&gt;

&lt;p&gt;So now let's try to make test webserver on Termux. Type &lt;code&gt;mkdir nodeservertest&lt;/code&gt; and &lt;code&gt;cd nodeservertest&lt;/code&gt; to run website from our directory. Now you have directory 'nodeservertest'! In this directory, node modules and running script will be saved. &lt;/p&gt;

&lt;p&gt;To write script we will write on desktop. Copy this on your desktop and save as 'web.js':&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/// web.js
const express = require('express')

const app = express();

const port = 3000;

app.get('/', (req, res) =&amp;gt; {
    res.send('Hello!');
})

app.listen(port, console.log(`Server is connected :  http://localhost:${port}/`));
~~~

Now connect your smartphone to your desktop with USB connect. Open your folder and copy 'web.js' and paste in 'yoursmartphone/Download/nodeservertest'.

We need module runner. Type `npm init -y`. Type `npm install express mysql`. When running web server, Module 'express' can make you run nodejs webserver without 'http' module. With module 'mysql' you can use data by connecting my sql server from nodejs server. 

Now we run web.js file at '~/nodeservertest/. Type 'node web.js'. Enter localhost:3000/ on your browser. You can see message 'Hello!' on the web. The web is connecting by asking listen method. 'Hello!' text was sent as responding to server. Responding was possible because you ask server to '/' by asking get method. Basically every http method like listen and get was available after you executing express with constant 'app'.

We gonna install mariadb because mysql server couldn't be installed on Termux. Type `pkg install mariadb`. Mariadb will run mysql server and send data to server from mysql database. 

After installing mysql, we run mysql webserver. First, slide from left to right on your Termux terminal. Then you can see 'NEW SESSION' button. You get new session after pushing the button! Type `mysqld_safe -u root &amp;amp;` on new session. This will make mariadb run on background. And we start mysql by typing `sudo mysql -u root`. Before rooting kernel you couldn't run root command 'sudo'. Now you entered mysql.

For connecting to server rightly, should we change password. Type `SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword');` on mysql session. Type,

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;CREATE DATABASE 'node';&lt;/p&gt;

&lt;p&gt;USE node&lt;/p&gt;

&lt;p&gt;CREATE TABLE test&lt;br&gt;
(id int(11) PRIMARY KEY NOT NULL AUTO INCREMENT, &lt;br&gt;
name varchar(50) NOT NULL, &lt;br&gt;
email varchar(255) NOT NULL);&lt;/p&gt;

&lt;p&gt;SET INTO test VALUES&lt;br&gt;
(1, 'test', '&lt;a href="mailto:test@test.com"&gt;test@test.com&lt;/a&gt;');&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
After running mysql server on second session, can we send data from database to server by writing some scripts to execute connecting. Let's add more on web.js. Put,{% raw %}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;/// Add this scripts into web.js file&lt;br&gt;
const mysql = require('mysql')&lt;/p&gt;

&lt;p&gt;const con = mysql.createConnection({&lt;br&gt;
    host: 'localhost',&lt;br&gt;
    user: 'root',&lt;br&gt;
    password: 'yourpassword',&lt;br&gt;
    database: 'node'&lt;br&gt;
});&lt;/p&gt;

&lt;p&gt;app.get('/', (err, result) =&amp;gt; {&lt;br&gt;
    con.query('SELECT * FROM test', (req, res) =&amp;gt; {&lt;br&gt;
        result.json(res);&lt;br&gt;
    });&lt;br&gt;
});&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
Now, your web.js file looks like this,{% raw %}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;/// web.js &lt;br&gt;
const express = require('express')&lt;br&gt;
const mysql = require('mysql')&lt;/p&gt;

&lt;p&gt;const app = express();&lt;/p&gt;

&lt;p&gt;const port = 3000;&lt;/p&gt;

&lt;p&gt;const con = mysql.createConnection({&lt;br&gt;
    host: 'localhost',&lt;br&gt;
    user: 'root',&lt;br&gt;
    password: 'yourpassword',&lt;br&gt;
    database: 'node'&lt;br&gt;
});&lt;/p&gt;

&lt;p&gt;app.get('/', (err, result) =&amp;gt; {&lt;br&gt;
    con.query('SELECT * FROM test', (req, res) =&amp;gt; {&lt;br&gt;
        result.json(res);&lt;br&gt;
    });&lt;br&gt;
});&lt;/p&gt;

&lt;p&gt;app.listen(port, console.log(&lt;code&gt;Server is connected :  http://localhost:${port}/&lt;/code&gt;));&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
So we command {% raw %}`node web.js` on first session and enter 'localhost:3000/' on the browser. Now you will see json on the browser!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>linux</category>
      <category>terminal</category>
      <category>node</category>
      <category>mysql</category>
    </item>
  </channel>
</rss>
