mirror of
https://gitlab.com/nekoya/web.git
synced 2024-11-29 11:42:40 +01:00
Edited main index.js
This commit is contained in:
parent
9381551dd7
commit
45eb8a05a7
1 changed files with 29 additions and 11 deletions
40
index.js
40
index.js
|
@ -1,15 +1,33 @@
|
||||||
const express = require('express')
|
var express = require("express");
|
||||||
const bodyParser = require('body-parser')
|
var cookieParser = require("cookie-parser");
|
||||||
const session = require('express-session')
|
var logger = require("morgan");
|
||||||
const app = express()
|
var bodyParser = require("body-parser");
|
||||||
|
const app = express();
|
||||||
|
|
||||||
app.use(express.static('public'))
|
app.use(bodyParser.urlencoded({ extended: true }));
|
||||||
app.set('view engine', 'ejs')
|
app.use(bodyParser.json());
|
||||||
|
app.use(logger("dev"));
|
||||||
|
app.use(express.json());
|
||||||
|
app.use(express.urlencoded({ extended: false }));
|
||||||
|
app.use(cookieParser());
|
||||||
|
|
||||||
const indexRouter = require('./routes/index');
|
app.use(express.static("public"));
|
||||||
|
app.set("view engine", "ejs");
|
||||||
|
|
||||||
app.use('/', indexRouter);
|
const indexRouter = require("./routes/index");
|
||||||
|
|
||||||
app.listen('3000', ()=> {
|
app.use("/", indexRouter);
|
||||||
console.log('Server sudah berjalan di port 3000')
|
|
||||||
})
|
app.use(function (req, res, next) {
|
||||||
|
res.header("Access-Control-Allow-Origin", "*");
|
||||||
|
res.header(
|
||||||
|
"Access-Control-Allow-Headers",
|
||||||
|
"Origin, X-Requested-With, Content-Type, Accept"
|
||||||
|
);
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
|
||||||
|
app.listen("3000", () => {
|
||||||
|
console.log("Server is running on port : 3000");
|
||||||
|
});
|
||||||
|
module.exports = app;
|
Loading…
Reference in a new issue