mirror of
https://github.com/FranP-code/open-react-blog-api.git
synced 2025-10-12 23:52:57 +00:00
Index routing done
This commit is contained in:
11
src/index.js
11
src/index.js
@@ -1,11 +0,0 @@
|
||||
const Express = require("express")
|
||||
const server = Express()
|
||||
|
||||
const port = 3000
|
||||
|
||||
server.get("/", (req, res) => {
|
||||
res.send("TEST")
|
||||
})
|
||||
|
||||
server.listen(port)
|
||||
console.log("Listening in the port ", port)
|
||||
10
src/routes/index.js
Normal file
10
src/routes/index.js
Normal file
@@ -0,0 +1,10 @@
|
||||
const express = require('express')
|
||||
const router = express.Router()
|
||||
|
||||
const path = require('path');
|
||||
|
||||
router.get("/", (req, res) => {
|
||||
res.sendFile(path.resolve('public/index.html'));
|
||||
})
|
||||
|
||||
module.exports = router
|
||||
10
src/server.js
Normal file
10
src/server.js
Normal file
@@ -0,0 +1,10 @@
|
||||
const express = require("express")
|
||||
const server = express()
|
||||
|
||||
const port = 3000
|
||||
|
||||
const index = require('./routes/index.js')
|
||||
server.use("/", index)
|
||||
|
||||
server.listen(port)
|
||||
console.log("Listening in the port ", port)
|
||||
Reference in New Issue
Block a user