Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relocation of assets and favicon #12

Merged
merged 2 commits into from
Oct 1, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Relocation of assets folder (into the public folder)
  • Loading branch information
ubeydeozdmr committed Oct 1, 2022
commit 2219cd0f3154077aabec98b27c955bc4cc2bbdf7
3 changes: 1 addition & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@ const { NODE_ENV } = process.env;

app.set('view engine', 'pug');
app.set('views', path.join(__dirname, 'views'));
app.use('/assets', express.static(path.join(__dirname, 'assets')));
app.use('/public', express.static(path.join(__dirname, 'public')));
app.use(cors());
app.options('*', cors());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));

app.get('/', (req, res) => {
const images = fs.readdirSync(path.join(__dirname, 'assets'));
const images = fs.readdirSync(path.join(__dirname, 'public/assets'));
res.render('index', {
host: req.get('host'),
protocol: req.protocol + '://',
Expand Down
2 changes: 1 addition & 1 deletion src/views/index.pug
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ head
}
title Turkiye API
header.hero
img.hero__img(src="assets/"+image alt='An image from Turkey/Turkiye')
img.hero__img(src="public/assets/"+image alt='An image from Turkey/Turkiye')
.hero__text-box
h1.hero__title Turkiye API
h2.hero__description
Expand Down