-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
21 lines (17 loc) · 816 Bytes
/
index.js
File metadata and controls
21 lines (17 loc) · 816 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const express = require('express');
const eci = require('./ecies');
const app = express();
const eccrypto = require("eccrypto");
app.use((req, res, next)=> {
console.log('Hello');
res.setHeader("Access-Control-Allow-Origin", "*"); // accepting all the requests from other servers
res.setHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization"); // types of headers sent along with response
res.setHeader("Access-Control-Allow-Methods", "GET, POST, PATCH, DELETE, OPTIONS, PUT"); //methods used along with request - response
next(); // enabling next "app." method
});
// app.get('/', (req,res) => {
// res.send('Hello world!');
// });
app.use(eci);
// Start the app by listening on the default Heroku port
app.listen(process.env.PORT || 4125);