mirror of
https://gitlab.com/nekoya/web.git
synced 2024-11-26 00:06:23 +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')
|
||||
const bodyParser = require('body-parser')
|
||||
const session = require('express-session')
|
||||
const app = express()
|
||||
var express = require("express");
|
||||
var cookieParser = require("cookie-parser");
|
||||
var logger = require("morgan");
|
||||
var bodyParser = require("body-parser");
|
||||
const app = express();
|
||||
|
||||
app.use(express.static('public'))
|
||||
app.set('view engine', 'ejs')
|
||||
app.use(bodyParser.urlencoded({ extended: true }));
|
||||
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', ()=> {
|
||||
console.log('Server sudah berjalan di port 3000')
|
||||
})
|
||||
app.use("/", indexRouter);
|
||||
|
||||
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