목록Personal DB (108)
Silver Library (Archived)
![](http://i1.daumcdn.net/thumb/C150x150.fwebp.q85/?fname=https://blog.kakaocdn.net/dn/HnoUe/btqXY0OCLXc/knf41bSBIDRav0iTwyE001/img.jpg)
To share the code contents of specific file (e.g. let app.js to share the code with init.js) Need to add 'export default app;' to the origin source. So, it can literally export so! 'export default app;' is the code. Then import it as follows: 'import app from "./app";' Now, here is all about 'routes'. How to use router? Router is the file which contains many route. 1. To let it work as router (d..
![](http://i1.daumcdn.net/thumb/C150x150.fwebp.q85/?fname=https://blog.kakaocdn.net/dn/vCYjO/btqXQ4Mexmv/VuaAGKDJdEzKPxHAVJ5RU0/img.jpg)
What is 'middleware' express? Something there goes connection until it goes finishes(executed). Between the user and last response. Something is in in that middle of it. In express, every function can become middleware. const betweenHome = () => console.log("I'm between"); If you turn on the page you input that const variable, now you can see the loading circle is spinning forever. That's how mi..
![](http://i1.daumcdn.net/thumb/C150x150.fwebp.q85/?fname=https://blog.kakaocdn.net/dn/uQl6c/btqXTmEDlCf/VENtgjBgndHiyNjYEIzCf0/img.jpg)
[Note: from now on, this section may link to express] What is babel? babel is a JS compiler. Basically, a tool to convert JS thing to backend like. babeljs.io/docs/en/ Babel · The compiler for next generation JavaScript The compiler for next generation JavaScript babeljs.io What is babel/preset-env? A Good source to refer this is here. velog.io/@pop8682/%EB%B2%88%EC%97%AD-%EC%99%9C-babel-preset%..
const express = require('express') const app = express() const PORT = 4000; function handleListening(){ console.log(`Listening on: http://localhost:${PORT}`); } function handleHome(req, res){ console.log('req'); res.send("Hello from home!") } function handleProfile(req, res){ res.send("You are on my profile") } app.get("/", handleHome) app.get("/profile", handleProfile); app.listen(PORT, handleL..